quantlab.dataset.config.SharadarDatasetConfig#

class quantlab.dataset.config.SharadarDatasetConfig(*, zarr_file_path, start_date=None, end_date=None, symbols=None, kwargs=None, resample_freq=None, resample_how=None, name=None, raw_data_dir_path, market='us_equity', frequency='1d', vendor='sharadar', table='sep', permatickers=None, roster_universe=None, category_filter='default')[source]#

Bases: DatasetConfig

Config of a Sharadar daily price panel on the permaticker axis.

Sharadar keys its price tables by ticker and renames a delisted company’s history when its ticker is reused, so the panel’s symbol axis is the permaticker, Sharadar’s unchanging integer id of one share class (ADR 0023). The inherited ticker-side symbols field is refused by the dataset; use permatickers instead.

Examples

>>> cfg = SharadarDatasetConfig(
...     zarr_file_path="/data/zarrs/sharadar_sep_1d.zarr",
...     raw_data_dir_path="/data/downloads/sharadar",
...     start_date="2015-01-01",
... )
>>> cfg.market, cfg.frequency, cfg.vendor, cfg.table
('us_equity', '1d', 'sharadar', 'sep')
category_filter = 'default'#

TICKERS category values an unrostered market universe keeps (one with neither permatickers nor roster_universe). "default" is the table’s own default, which the dataset resolves: for SEP, domestic common stock, every share class of it (ADRs, Canadian filers, preferreds and anything else are dropped); for SFP, every fund category (None). None keeps every category. Ignored when a roster is set: a named security is never filtered out.

classmethod etf_benchmark(*, permaticker, zarr_file_path, raw_data_dir_path, start_date=None, end_date=None)[source]#

Return the config of an SFP store holding only one benchmark fund.

A backtest benchmark is a market dataset with exactly one symbol; table="sfp" and permatickers=(permaticker,) give that, and a named permaticker is never filtered by category.

Parameters:
permatickerint

The fund’s permaticker, from the TICKERS rows of table SFP.

zarr_file_pathstr

Path of the benchmark’s own Zarr store.

raw_data_dir_pathstr

<download-dir>/sharadar.

start_date, end_datestr or None

The window to convert, both inclusive.

Examples

>>> cfg = SharadarDatasetConfig.etf_benchmark(
...     permaticker=118691,
...     zarr_file_path="/data/zarrs/sharadar_spy_1d.zarr",
...     raw_data_dir_path="/data/downloads/sharadar",
... )
>>> cfg.table, cfg.permatickers
('sfp', (118691,))
frequency = '1d'#

Always daily for this vendor.

market = 'us_equity'#

Always US equity for this vendor.

permatickers = None#

Restrict the conversion to these permatickers, an explicit roster that category_filter never touches. An empty tuple is refused.

roster_universe = None#

An index whose members form an explicit roster: every permaticker that was a member at some point in [start_date, end_date] is converted, with all its bars and whatever its category. "sp500" reads the raw SP500 table. Combined with permatickers, the roster is the union.

table = 'sep'#

Code of the price table the panel is built from (a key of quantlab.dataset.sharadar.tables.TABLES); its raw parquet lives in <raw_data_dir_path>/<table>/.

vendor = 'sharadar'#

Always Sharadar for this dataset.