quantlab.dataset.sharadar.tickers#

The ticker sidecar of a Sharadar store: permatickers shown as the ticker in use that day.

A Sharadar panel’s symbol axis is the permaticker, Sharadar’s unchanging integer id of one share class: right for code, but not what a person reads in a backtest’s Holdings tab or its settlements.json. Sharadar renames a security’s whole history to its current ticker, so the price table alone never says that permaticker 194817 traded as FB before it was META. The names come from two raw tables:

  • TICKERS gives each permaticker its current ticker and company, from the rows labelled with the store’s table (SEP or stocks for SEP), so a fund’s row never names a stock;

  • ACTIONS gives each ticker change as a tickerchangefrom row: on its date the security, then trading as contraticker (company contraname), became ticker.

ticker_sidecar_payload builds, for given permatickers, a list of spans per permaticker (the first day each ticker was in use, null for the first), and SharadarTickerLookup answers “which ticker and company did this permaticker have on this day” from the JSON file <store>.sharadar_tickers.json beside the store. A conversion of SharadarStockDataset writes the file; write_ticker_sidecar and scripts/sharadar/ticker_sidecar.py write it for an existing store.

The lookup is for display: names never raises. A permaticker the file does not know reads as its own id; so does every permaticker when the file is missing or damaged, with one warning per lookup object.

Examples#

>>> lookup = SharadarTickerLookup("/data/market/sharadar/sharadar_sep_1d/sharadar_sep_1d.zarr.sharadar_tickers.json")
>>> lookup.label([194817], date(2022, 6, 8)), lookup.label([194817], date(2022, 6, 9))
(['FB'], ['META'])

Classes

SharadarTickerLookup

The ticker and company a permaticker had on a day, from one <store>.sharadar_tickers.json.

Functions

ticker_sidecar_payload

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