Expand description
Databento message decoding functions.
§Sentinel Values
Databento uses sentinel values to represent undefined/null fields:
| Sentinel | Value | Usage |
|---|---|---|
UNDEF_PRICE | i64::MAX | Undefined price fields. |
UNDEF_TIMESTAMP | u64::MAX | Undefined timestamp fields. |
§Fields Potentially Undefined
According to Databento documentation, the following fields can contain sentinel values:
| Message Type | Field | Handling |
|---|---|---|
MboMsg | price | Passed through as PRICE_UNDEF. |
TradeMsg | price | Passed through as PRICE_UNDEF. |
OhlcvMsg | open, high, low, close | Passed through as PRICE_UNDEF. |
Mbp1Msg | bid_px, ask_px | Quote skipped if either undefined. |
InstrumentDefMsg | activation | Defaults to 0 (epoch). |
InstrumentDefMsg | expiration | Returns error if undefined. |
InstrumentDefMsg | strike_price | Returns error if undefined. |
§References
Functions§
- decode_
bar_ type - Errors
- decode_
bbo_ msg - Decodes a Databento BBO (Best Bid and Offer) message into a
QuoteTick. - decode_
cbbo_ msg - Decodes a Databento CBBO (Consolidated Best Bid and Offer) message.
- decode_
cmbp1_ msg - Decodes a Databento CMBP1 (Consolidated Market by Price Level 1) message.
- decode_
equity - Decodes a Databento instrument definition message into an
Equityinstrument. - decode_
futures_ contract - Decodes a Databento instrument definition message into a
FuturesContractinstrument. - decode_
futures_ spread - Decodes a Databento instrument definition message into a
FuturesSpreadinstrument. - decode_
imbalance_ msg - Decodes a Databento imbalance message into a
DatabentoImbalanceevent. - decode_
instrument_ def_ msg - Errors
- decode_
lot_ size - Decodes a lot size from the given value, expressed in standard whole-number units.
- decode_
mbo_ msg - Decodes a Databento MBO (Market by Order) message into an order book delta or trade.
- decode_
mbp1_ msg - Decodes a Databento MBP1 (Market by Price Level 1) message into quote and optional trade ticks.
- decode_
mbp10_ msg - Decodes a Databento MBP10 (Market by Price 10 levels) message into an
OrderBookDepth10. - decode_
multiplier - Decodes a multiplier from the given value, expressed in units of 1e-9. Uses exact integer arithmetic to avoid precision loss in financial calculations.
- decode_
ohlcv_ msg - Errors
- decode_
option_ contract - Decodes a Databento instrument definition message into an
OptionContractinstrument. - decode_
option_ spread - Decodes a Databento instrument definition message into an
OptionSpreadinstrument. - decode_
optional_ price - Decodes a price from the given optional value, expressed in units of 1e-9.
- decode_
optional_ quantity - Decodes a quantity from the given optional value, where
i64::MAXindicates missing data. - decode_
optional_ timestamp - Decodes a timestamp from the given optional value.
- decode_
price - Decodes a price, returning an error if undefined.
- decode_
price_ increment - Decodes a minimum price increment from the given value, expressed in units of 1e-9.
- decode_
price_ or_ undef - Decodes a price, returning
PRICE_UNDEFif the value is undefined. - decode_
quantity - Decodes a quantity from the given value, expressed in standard whole-number units.
- decode_
record - Errors
- decode_
statistics_ msg - Decodes a Databento statistics message into a
DatabentoStatisticsevent. - decode_
status_ msg - Decodes a Databento status message into an
InstrumentStatusevent. - decode_
tbbo_ msg - Decodes a Databento TBBO (Top of Book with Trade) message into quote and trade ticks.
- decode_
tcbbo_ msg - Decodes a Databento TCBBO (Consolidated Top of Book with Trade) message.
- decode_
timestamp - Decodes a timestamp, returning an error if undefined.
- decode_
trade_ msg - Decodes a Databento Trade message into a
TradeTick. - decode_
ts_ event_ adjustment - Errors
- parse_
aggressor_ side - parse_
book_ action - Parses a Databento book action character into a
BookActionenum. - parse_
cfi_ iso10926 - Parses a CFI (Classification of Financial Instruments) code to extract asset and instrument classes.
- parse_
option_ kind - Parses a Databento option kind character into an
OptionKindenum. - parse_
optional_ bool - parse_
order_ side - parse_
status_ reason - Parses a Databento status reason code into a human-readable string.
- parse_
status_ trading_ event - Parses a Databento status trading event code into a human-readable string.