Module decode

Module decode 

Source
Expand description

Databento message decoding functions.

§Sentinel Values

Databento uses sentinel values to represent undefined/null fields:

SentinelValueUsage
UNDEF_PRICEi64::MAXUndefined price fields.
UNDEF_TIMESTAMPu64::MAXUndefined timestamp fields.

§Fields Potentially Undefined

According to Databento documentation, the following fields can contain sentinel values:

Message TypeFieldHandling
MboMsgpricePassed through as PRICE_UNDEF.
TradeMsgpricePassed through as PRICE_UNDEF.
OhlcvMsgopen, high, low, closePassed through as PRICE_UNDEF.
Mbp1Msgbid_px, ask_pxQuote skipped if either undefined.
InstrumentDefMsgactivationDefaults to 0 (epoch).
InstrumentDefMsgexpirationReturns error if undefined.
InstrumentDefMsgstrike_priceReturns 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 Equity instrument.
decode_futures_contract
Decodes a Databento instrument definition message into a FuturesContract instrument.
decode_futures_spread
Decodes a Databento instrument definition message into a FuturesSpread instrument.
decode_imbalance_msg
Decodes a Databento imbalance message into a DatabentoImbalance event.
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 OptionContract instrument.
decode_option_spread
Decodes a Databento instrument definition message into an OptionSpread instrument.
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::MAX indicates 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_UNDEF if 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 DatabentoStatistics event.
decode_status_msg
Decodes a Databento status message into an InstrumentStatus event.
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 BookAction enum.
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 OptionKind enum.
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.