quantlab.acquisition.wrds#

WRDS vendor package and the registry entry for a WRDS account.

WRDS (Wharton Research Data Services) is a university-run data service. One WRDS login reaches several licensed data products through a PostgreSQL server. This package downloads two of them, each with its own submodule and acquisition class.

quantlab.acquisition.wrds.taq downloads NYSE TAQ (“Trade and Quote”) millisecond data, specifically the NBBO (National Best Bid and Offer: the highest bid and lowest ask across all US exchanges at each instant), through WrdsTaqNbboAcquisition. quantlab.acquisition.wrds.taq_bars downloads the same quotes already resampled into bars on the WRDS server (ADR 0027), through WrdsTaqNbboBarsAcquisition, with the statement built by quantlab.acquisition.wrds.nbbo_bars_sql. quantlab.acquisition.wrds.crsp downloads CRSP (Center for Research in Security Prices) Stock v2 daily bars through WrdsCrspDailyAcquisition.

Both products log in the same way and share one database connection, taq.WrdsSession. The session reads the username from the WRDS_USERNAME environment variable and leaves the password to the PostgreSQL client library, which reads it from ~/.pgpass. One session per process pools at most WrdsSession.MAX_CONNECTIONS connections, so parallel download workers each query on their own connection while the account’s connection limit is respected.

WRDS_SOURCE registers this vendor with quantlab.acquisition.registry. It is a single descriptor for the whole account, and each of its Capability rows names the acquisition class and config factory of one product. The descriptor lives here, not beside one of the two classes, because otherwise one provider module would have to import the other to declare its capability. The provider modules import nothing from the registry or from this module.

Examples#

>>> from quantlab.acquisition.wrds import WRDS_SOURCE
>>> sorted((c.market, c.frequency, c.data_type)
...        for c in WRDS_SOURCE.capabilities)
[('us_equity', '1d', 'crsp_daily'), ('us_equity', '1m', 'nbbo_bars'), ('us_equity', 'tick', 'nbbo')]
>>> WRDS_SOURCE.required_env
('WRDS_USERNAME',)

Modules

crsp

Download of CRSP daily stock data from WRDS, keyed by PERMNO.

crsp_reference

Download of the CRSP, Compustat and CCM reference tables into _reference/.

nbbo_bars_sql

The SQL statement that resamples TAQ NBBO records into bars on the WRDS server.

rebuild

Rebuild a CRSP daily store from the raw and reference files already on disk.

taq

Download of NYSE TAQ quote data from WRDS, and the shared WRDS connection.

taq_bars

Download of NBBO bars resampled on the WRDS server (ADR 0027).