quantlab.dataset.massive.rest_panel.MassiveRestPanel#

class quantlab.dataset.massive.rest_panel.MassiveRestPanel[source]#

Bases: object

Mixin of a Sharadar panel built from Massive’s REST records placed through the Ticker map.

Put it before the panel’s base class (ReleasePanelDataset or a subclass) and set REST_ENDPOINTS. The config is a MassiveRestPanelConfig.

Examples

MassiveDisclosureDataset is one:

class MassiveDisclosureDataset(MassiveRestPanel, FilingPanelDataset):
    REST_ENDPOINTS = ("8k_disclosures",)
EARLIEST = datetime.date(1970, 1, 1)#

The latest first day of those endpoints (their RestEndpoint.earliest): a first build starts no earlier. Declared here because the dataset layer comes before acquisition; a test locks it to ENDPOINTS.

REST_ENDPOINTS = ()#

The REST endpoints read (quantlab.acquisition.massive.rest.ENDPOINTS); the store is built only through the day each one is pulled through.

STORE_NAME = ''#

The store folder’s name under STORE_AREA, and its store’s stem.

STORE_README = ''#

The folder’s README.md, written by a first build when there is none.

classmethod from_data_root(data_dir, download_dir)[source]#

Return the panel of its store folder under data_dir, writing the folder on the first call.

A folder holding component.json is rebuilt from it. Otherwise the config is built on the shared layout: the store <data_dir>/market/massive/<STORE_NAME>/<STORE_NAME>.zarr, Sharadar’s raw tier <download_dir>/sharadar, Massive’s <download_dir>/massive, the Ticker map <data_dir>/market/massive/massive_ticker_map/massive_ticker_map, from the later of the map’s first day and EARLIEST, with no end; component.json is written, and STORE_README when the folder has no README.md. Nothing is read from or written to the store itself: update() builds it.

Parameters:
data_dirstr or pathlib.Path

The data root.

download_dirstr or pathlib.Path

The download root, holding sharadar/ and massive/.

Returns:
MassiveRestPanel

The panel, ready to update().

Raises:
ValueError

If the folder has no component.json and the Ticker map maps no day (naming ticker_map.py); nothing is written then.

Examples

Needs the raw tiers and the Ticker map under the two roots, so it is not run here:

ds = MassiveShortVolumeDataset.from_data_root("/data/quantlab", "/data/quantlab/downloads")
ds.update().store_path
# '/data/quantlab/market/massive/massive_short_volume_1d/massive_short_volume_1d.zarr'
property ticker_map#

The Ticker map the records are placed through.

Examples

With config a MassiveDividendsConfig:

MassiveDividendDataset(config).ticker_map.path.name
# 'massive_ticker_map'
property unplaced_path#

The report of the records left out (<store>.unplaced.json).

Examples

With config a MassiveDividendsConfig of the store massive_dividends_1d.zarr:

MassiveDividendDataset(config).unplaced_path
# '.../massive_dividends_1d.zarr.unplaced.json'