map_symbols_csv
Use a symbology.json file to map a symbols column onto an existing CSV file. The result is written to out_file.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
symbology_file | PathLike[str] or str | required | Path to a symbology.json file to use as a symbology source. |
csv_file | PathLike[str] or str | required | Path to a CSV file that contains encoded DBN data; must contain a ts_recv or ts_event and instrument_id column. |
out_file | PathLike[str] or str | optional | Path to a file to write results to. If unspecified, _mapped will be appended to the csv_file name. |
Returns
Path to the written file.
API method
1 2 3 4 5
map_symbols_csv(
symbology_file: PathLike[str] | str,
csv_file: PathLike[str] | str,
out_file: PathLike[str] | str | None = None,
) -> Path: Example usage
1 2 3 4 5 6 7 8
import databento as db
result = db.map_symbols_csv(
"symbology.json",
"xnas-itch-20230821-20230825.ohlcv-1d.csv",
)
print(result.read_text()) Example response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
ts_event,rtype,publisher_id,instrument_id,open,high,low,close,volume,symbol 1692576000000000000,35,2,523,133550000000,135200000000,132710000000,134360000000,11015261,AMZN 1692576000000000000,35,2,7290,439090000000,472900000000,437260000000,470990000000,11098972,NVDA 1692576000000000000,35,2,10157,217000000000,233500000000,217000000000,233380000000,21336884,TSLA 1692576000000000000,35,2,7130,430170000000,434700000000,0,433000000000,68661,NOC 1692662400000000000,35,2,7132,431610000000,438480000000,0,437740000000,86950,NOC 1692662400000000000,35,2,10161,236710000000,241550000000,229560000000,232870000000,17069349,TSLA 1692662400000000000,35,2,523,135320000000,135900000000,133740000000,134200000000,8133698,AMZN 1692662400000000000,35,2,7293,475120000000,483440000000,453340000000,457910000000,11700447,NVDA 1692748800000000000,35,2,523,135120000000,137860000000,133220000000,137060000000,11430081,AMZN 1692748800000000000,35,2,7296,463190000000,518870000000,452080000000,502150000000,13361964,NVDA 1692748800000000000,35,2,7135,0,440000000000,0,434030000000,68411,NOC 1692748800000000000,35,2,10163,236590000000,243750000000,226500000000,240810000000,13759234,TSLA 1692835200000000000,35,2,7287,508190000000,512600000000,466720000000,468700000000,21611800,NVDA 1692835200000000000,35,2,10154,242000000000,244140000000,228180000000,229980000000,13724054,TSLA 1692835200000000000,35,2,7126,433650000000,437730000000,0,429880000000,54570,NOC 1692835200000000000,35,2,521,137250000000,137820000000,131410000000,131880000000,11990573,AMZN