Databento

class DatabentoDataClientFactory

Bases: object

Factory for creating Databento data clients.

static create_live_data_client(client_id, api_key, publishers_filepath, use_exchange_as_venue=True, bars_timestamp_on_close=True)

Creates a new DatabentoDataClient instance.

# Errors

Returns an error if the client cannot be created or publisher configuration cannot be loaded.

name()
class DatabentoDataLoader

Bases: object

A Nautilus data loader for Databento Binary Encoding (DBN) format data.

# Supported Schemas
  • MBO -> OrderBookDelta

  • MBP_1 -> (QuoteTick, Option<TradeTick>)

  • MBP_10 -> OrderBookDepth10

  • BBO_1S -> QuoteTick

  • BBO_1M -> QuoteTick

  • CMBP_1 -> (QuoteTick, Option<TradeTick>)

  • CBBO_1S -> QuoteTick

  • CBBO_1M -> QuoteTick

  • TCBBO -> (QuoteTick, TradeTick)

  • TBBO -> (QuoteTick, TradeTick)

  • TRADES -> TradeTick

  • OHLCV_1S -> Bar

  • OHLCV_1M -> Bar

  • OHLCV_1H -> Bar

  • OHLCV_1D -> Bar

  • OHLCV_EOD -> Bar

  • DEFINITION -> Instrument

  • IMBALANCE -> DatabentoImbalance

  • STATISTICS -> DatabentoStatistics

  • STATUS -> InstrumentStatus

# References

<https://databento.com/docs/schemas-and-data-formats>

get_dataset_for_venue(venue)

Returns the dataset which matches the given venue (if found).

get_price_precisions()

Returns the cached price precisions keyed by symbol.

get_publishers()

Returns the internal Databento publishers currently held by the loader.

get_venue_for_publisher(publisher_id)

Returns the venue which matches the given publisher_id (if found).

load_bars(filepath, instrument_id=None, price_precision=None, timestamp_on_close=True)

Loads OHLCV bar messages from a DBN OHLCV schema file.

# Errors

Returns an error if loading bars fails.

load_bbo_quotes(filepath, instrument_id=None, price_precision=None)

Loads best bid/offer quote messages from a DBN BBO schema file.

# Errors

Returns an error if loading BBO quotes fails.

load_cbbo_quotes(filepath, instrument_id=None, price_precision=None)

Loads consolidated best bid/offer quote messages from a DBN CBBO schema file.

# Errors

Returns an error if loading consolidated BBO quotes fails.

load_cmbp_quotes(filepath, instrument_id=None, price_precision=None)

Loads consolidated MBP-1 quote messages from a DBN CMBP-1 schema file.

# Errors

Returns an error if loading consolidated MBP-1 quotes fails.

load_imbalance(filepath, instrument_id=None, price_precision=None)
load_instruments(filepath, use_exchange_as_venue, skip_on_error=False, expiration_overrides=None)

Loads all instrument definitions from a DBN file.

When skip_on_error is true, instruments that fail to decode are logged as warnings and skipped. When false (default), any decode error is propagated.

# Errors

Returns an error if loading instruments fails.

load_order_book_deltas(filepath, instrument_id=None, price_precision=None)

Loads order book delta messages from a DBN MBO schema file.

Cannot include trades.

# Errors

Returns an error if loading order book deltas fails.

load_order_book_depth10(filepath, instrument_id=None, price_precision=None)

Loads order book depth10 snapshots from a DBN MBP-10 schema file.

# Errors

Returns an error if loading order book depth10 fails.

load_publishers(publishers_filepath)

Load the publishers data from the file at the given filepath.

# Errors

Returns an error if the file cannot be read or parsed as JSON.

load_quotes(filepath, instrument_id=None, price_precision=None)

Loads quote tick messages from a DBN MBP-1 or TBBO schema file.

# Errors

Returns an error if loading quotes fails.

load_statistics(filepath, instrument_id=None, price_precision=None)
load_status(filepath, instrument_id=None)
load_tbbo_trades(filepath, instrument_id=None, price_precision=None)

Loads trade messages from a DBN TBBO schema file.

# Errors

Returns an error if loading TBBO trades fails.

load_tcbbo_trades(filepath, instrument_id=None, price_precision=None)

Loads trade messages from a DBN TCBBO schema file.

# Errors

Returns an error if loading TCBBO trades fails.

load_trades(filepath, instrument_id=None, price_precision=None)

Loads trade messages from a DBN TRADES schema file.

# Errors

Returns an error if loading trades fails.

schema_for_file(filepath)
set_dataset_for_venue(dataset, venue)

Sets the venue to map to the given dataset.

set_price_precision(symbol, price_precision)

Caches a price_precision for the given symbol.

When market data is read without an explicit price_precision argument, the loader resolves precision per record from this cache. Definitions loaded via Self.load_instruments are inserted automatically.

class DatabentoImbalance

Bases: object

Represents an auction imbalance.

This data type includes the populated data fields provided by Databento, excluding publisher_id and instrument_id.

auct_interest_clr_price
cont_book_clr_price
static from_dict(values)
instrument_id
paired_qty
ref_price
side
significant_imbalance
to_dict()

Return a dictionary representation of the object.

total_imbalance_qty
ts_event
ts_init
ts_recv
class DatabentoLiveClientConfig

Bases: object

Configuration for Databento data clients used with LiveNode.

bars_timestamp_on_close
publishers_filepath
use_exchange_as_venue
venue_dataset_map
class DatabentoPublisher

Bases: object

Represents a Databento publisher.

class DatabentoStatisticType

Bases: object

Represents a Databento statistic type.

BLOCK_VOLUME = <DatabentoStatisticType.BLOCK_VOLUME: '19'>
CLEARED_VOLUME = <DatabentoStatisticType.CLEARED_VOLUME: '6'>
CLOSE_PRICE = <DatabentoStatisticType.CLOSE_PRICE: '11'>
DELTA = <DatabentoStatisticType.DELTA: '15'>
FIXING_PRICE = <DatabentoStatisticType.FIXING_PRICE: '10'>
HIGHEST_BID = <DatabentoStatisticType.HIGHEST_BID: '8'>
INDICATIVE_CLOSE_PRICE = <DatabentoStatisticType.INDICATIVE_CLOSE_PRICE: '20'>
INDICATIVE_OPENING_PRICE = <DatabentoStatisticType.INDICATIVE_OPENING_PRICE: '2'>
LOWER_PRICE_LIMIT = <DatabentoStatisticType.LOWER_PRICE_LIMIT: '18'>
LOWEST_OFFER = <DatabentoStatisticType.LOWEST_OFFER: '7'>
NET_CHANGE = <DatabentoStatisticType.NET_CHANGE: '12'>
OPENING_PRICE = <DatabentoStatisticType.OPENING_PRICE: '1'>
OPEN_INTEREST = <DatabentoStatisticType.OPEN_INTEREST: '9'>
SETTLEMENT_PRICE = <DatabentoStatisticType.SETTLEMENT_PRICE: '3'>
TRADING_SESSION_HIGH_PRICE = <DatabentoStatisticType.TRADING_SESSION_HIGH_PRICE: '5'>
TRADING_SESSION_LOW_PRICE = <DatabentoStatisticType.TRADING_SESSION_LOW_PRICE: '4'>
UNCROSSING_PRICE = <DatabentoStatisticType.UNCROSSING_PRICE: '16'>
UPPER_PRICE_LIMIT = <DatabentoStatisticType.UPPER_PRICE_LIMIT: '17'>
VOLATILITY = <DatabentoStatisticType.VOLATILITY: '14'>
VWAP = <DatabentoStatisticType.VWAP: '13'>
classmethod from_str(data)
name
value
class DatabentoStatisticUpdateAction

Bases: object

Represents a Databento statistic update action.

ADDED = <DatabentoStatisticUpdateAction.ADDED: '1'>
DELETED = <DatabentoStatisticUpdateAction.DELETED: '2'>
classmethod from_str(data)
name
value
class DatabentoStatistics

Bases: object

Represents a market statistics snapshot.

This data type includes the populated data fields provided by Databento, excluding publisher_id and instrument_id.

channel_id
static from_dict(values)
instrument_id
price
quantity
sequence
stat_flags
stat_type
to_dict()

Return a dictionary representation of the object.

ts_event
ts_in_delta
ts_init
ts_recv
ts_ref
update_action
get_databento_arrow_schema_map(cls)

Returns a mapping from field names to Arrow data types for the given Databento data class.

# Errors

Returns a PyErr if the class name is not recognized.