|
1 | | -ALL_SYMBOLS = "ALL_SYMBOLS" |
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from typing import Final |
| 4 | + |
| 5 | +import numpy as np |
| 6 | +from databento_dbn import ImbalanceMsg |
| 7 | +from databento_dbn import InstrumentDefMsg |
| 8 | +from databento_dbn import InstrumentDefMsgV1 |
| 9 | +from databento_dbn import MBOMsg |
| 10 | +from databento_dbn import MBP1Msg |
| 11 | +from databento_dbn import MBP10Msg |
| 12 | +from databento_dbn import OHLCVMsg |
| 13 | +from databento_dbn import Schema |
| 14 | +from databento_dbn import StatMsg |
| 15 | +from databento_dbn import TradeMsg |
| 16 | + |
| 17 | +from databento.common.types import DBNRecord |
| 18 | + |
| 19 | + |
| 20 | +ALL_SYMBOLS: Final = "ALL_SYMBOLS" |
| 21 | + |
| 22 | + |
| 23 | +DEFINITION_TYPE_MAX_MAP: Final = { |
| 24 | + x[0]: np.iinfo(x[1]).max |
| 25 | + for x in InstrumentDefMsg._dtypes |
| 26 | + if not isinstance(x[1], str) |
| 27 | +} |
| 28 | + |
| 29 | +INT64_NULL: Final = 9223372036854775807 |
| 30 | + |
| 31 | +SCHEMA_STRUCT_MAP: Final[dict[Schema, type[DBNRecord]]] = { |
| 32 | + Schema.DEFINITION: InstrumentDefMsg, |
| 33 | + Schema.IMBALANCE: ImbalanceMsg, |
| 34 | + Schema.MBO: MBOMsg, |
| 35 | + Schema.MBP_1: MBP1Msg, |
| 36 | + Schema.MBP_10: MBP10Msg, |
| 37 | + Schema.OHLCV_1S: OHLCVMsg, |
| 38 | + Schema.OHLCV_1M: OHLCVMsg, |
| 39 | + Schema.OHLCV_1H: OHLCVMsg, |
| 40 | + Schema.OHLCV_1D: OHLCVMsg, |
| 41 | + Schema.STATISTICS: StatMsg, |
| 42 | + Schema.TBBO: MBP1Msg, |
| 43 | + Schema.TRADES: TradeMsg, |
| 44 | +} |
| 45 | + |
| 46 | +SCHEMA_STRUCT_MAP_V1: Final[dict[Schema, type[DBNRecord]]] = { |
| 47 | + Schema.DEFINITION: InstrumentDefMsgV1, |
| 48 | + Schema.IMBALANCE: ImbalanceMsg, |
| 49 | + Schema.MBO: MBOMsg, |
| 50 | + Schema.MBP_1: MBP1Msg, |
| 51 | + Schema.MBP_10: MBP10Msg, |
| 52 | + Schema.OHLCV_1S: OHLCVMsg, |
| 53 | + Schema.OHLCV_1M: OHLCVMsg, |
| 54 | + Schema.OHLCV_1H: OHLCVMsg, |
| 55 | + Schema.OHLCV_1D: OHLCVMsg, |
| 56 | + Schema.STATISTICS: StatMsg, |
| 57 | + Schema.TBBO: MBP1Msg, |
| 58 | + Schema.TRADES: TradeMsg, |
| 59 | +} |
0 commit comments