quantlab.dataset.sharadar.tickers.ticker_sidecar_payload#

quantlab.dataset.sharadar.tickers.ticker_sidecar_payload(vendor_root, code, permatickers, previous=None)[source]#

Return the ticker sidecar of permatickers from the raw TICKERS and ACTIONS tables.

The sidecar is also what a later conversion maps an old raw file’s tickers with (quantlab.dataset.sharadar.permatickers), so what an earlier sidecar knew is carried forward rather than lost when TICKERS forgets it: a permaticker TICKERS no longer lists keeps its earlier spans, and a ticker the vendor renamed away without an ACTIONS row (a reused ticker’s old holder gets a suffixed one) is kept under former.

Parameters:
vendor_rootstr or Path

<download-dir>/sharadar, holding TICKERS and ACTIONS.

codestr

The store’s price table ("sep" or "sfp"), whose TICKERS rows map tickers to permatickers.

permatickersiterable of int

The store’s symbols. A permaticker without a TICKERS row of the table and without spans in previous is left out of the sidecar, and reads as its id.

previousdict, optional

The sidecar this one replaces, as read from its file.

Returns:
dict

{"table": code, "intervals": {permaticker: [span, ...]}, "former": {permaticker: [span, ...]}}, each span {"start", "ticker", "company"}: the first day the ticker was in use (None for the first span, or when unknown), the ticker and the company (None when the tables record none; an earlier ticker’s company is the contraname of its change). Spans are in date order and permatickers in numeric order. former lists tickers an earlier sidecar gave a permaticker that its current spans no longer name; the lookup does not show them.

Examples

>>> payload = ticker_sidecar_payload("/data/downloads/sharadar", "sep", [194817])
>>> [span["ticker"] for span in payload["intervals"]["194817"]]
['FB', 'META']