quantlab.dataset.sharadar.permatickers.map_raw_table#
- quantlab.dataset.sharadar.permatickers.map_raw_table(vendor_root, code, *, owner, query=None, store_path=None, sidecar_path=None, date_column='date', quiet=False, key=None, report_unmapped=True)[source]#
Read one raw table with each row’s permaticker, leaving out and reporting the unmapped rows.
The rows are mapped through the TICKERS rows of
code’s mapping labels (tables.SharadarTable.mapping_labels), each raw file as of its own pull (PermatickerResolver).- Parameters:
- vendor_rootstr or Path
<download-dir>/sharadar.- codestr
The raw table to read (
"sf1","daily","events", …).- ownerstr
Named in messages.
- querycallable, optional
Applied to the annotated scan before it is collected (filters, a column selection keeping
ticker,permatickeranddate_column).- store_pathstr or Path, optional
The store the rows feed: the report goes to
<store_path>.unmapped.json(UNMAPPED_SUFFIX).Nonewrites no report.- sidecar_pathstr or Path, optional
A ticker sidecar to map old tickers with (
PermatickerResolver).- date_columnstr, default “date”
The column the report dates rows by.
- quietbool, default False
Log the left-out rows at
info(PermatickerResolver.left_out).- keyiterable of str, optional
The columns (after
query) that, with the permaticker, name one row: rows of one security under several tickers on one key are settled (PermatickerResolver.settle).Nonesettles nothing.- report_unmappedbool, default True
PermatickerResolver.left_out.
- Returns:
- pl.DataFrame
The rows with a
permatickercolumn, unmapped ones left out.
- Raises:
- ValueError
If a ticker maps to several permatickers in TICKERS or in its file’s TICKERS snapshot.
Examples
>>> rows = map_raw_table("/data/downloads/sharadar", "daily", owner="demo", ... store_path="/data/market/sharadar/sharadar_daily_1d/sharadar_daily_1d.zarr") >>> rows.columns[-1] 'permaticker'