Data¶
The data subpackage groups components relating to the data stack and data tooling for the platform.
The layered architecture of the data stack somewhat mirrors the execution stack with a central engine, cache layer beneath, database layer beneath, with alternative implementations able to be written on top.
Due to the high-performance, the core components are reusable between both backtest and live implementations - helping to ensure consistent logic for trading operations.
Aggregation¶
- class BarAggregator¶
Bases:
objectBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of aggregating specified bars and sending to a registered handler.
The aggregator maintains two state flags exposed as properties: - historical_mode: Indicates the aggregator is processing historical data. - is_running: Indicates the aggregator is receiving data from the message bus.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (TradeTick) – The tick for the update.
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class BarBuilder¶
Bases:
objectBarBuilder(Instrument instrument, BarType bar_type) -> None
Provides a generic bar builder for aggregation.
- Parameters:
instrument (Instrument) – The instrument for the builder.
bar_type (BarType) – The bar type for the builder.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- build(self, uint64_t ts_event, uint64_t ts_init) Bar¶
Return the aggregated bar with the given closing timestamp, and reset.
- Parameters:
ts_event (uint64_t) – UNIX timestamp (nanoseconds) for the bar event.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) for the bar initialization.
- Return type:
- count¶
The builders current update count.
- Returns:
int
- initialized¶
If the builder is initialized.
- Returns:
bool
- price_precision¶
The price precision for the builders instrument.
- Returns:
uint8
- reset(self) void¶
Reset the bar builder.
All stateful fields are reset to their initial value.
- size_precision¶
The size precision for the builders instrument.
- Returns:
uint8
- ts_last¶
UNIX timestamp (nanoseconds) when the builder last updated.
- Returns:
uint64_t
- class RenkoBarAggregator¶
Bases:
BarAggregatorRenkoBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building Renko bars from ticks.
Renko bars are created when the price moves by a fixed amount (brick size) regardless of time or volume. Each bar represents a price movement equal to the step size in the bar specification.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- brick_size¶
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (TradeTick) – The tick for the update.
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class SpreadQuoteAggregator¶
Bases:
objectSpreadQuoteAggregator(Instrument spread_instrument, handler: Callable[[QuoteTick], None], GreeksCalculator greeks_calculator, Clock clock, bool historical, update_interval_seconds=None, int quote_build_delay=0)
Provides a spread quote generator for creating synthetic quotes from leg instruments.
The generator receives quote ticks from leg instruments via handler callbacks and generates synthetic quotes for the spread instrument. Pricing logic differs by instrument type:
Futures spreads: Calculates weighted bid/ask prices based on leg ratios (positive ratios use bid/ask directly, negative ratios invert bid/ask).
Option spreads: Uses vega-weighted spread calculation to determine bid/ask spreads, then applies to the weighted mid-price based on leg ratios.
The aggregator requires quotes from all legs before building a spread quote. It can operate in two modes:
Quote-driven mode (update_interval_seconds=None): Receives quote tick updates via handler and builds spread quotes immediately when all legs have received quotes. This is the default and recommended mode for most use cases.
Timer-driven mode (update_interval_seconds=int): Uses a periodic timer to read quotes from internal state and build spread quotes at regular intervals. In historical mode, timer events are processed when quotes arrive, ensuring all quotes for a given timestamp are received before processing timer events for that timestamp.
In historical mode, the aggregator advances the provided clock independently with incoming data timestamps, similar to TimeBarAggregator. Timer events are generated by advancing the clock and are processed only when all legs have received quotes for the corresponding timestamp.
- Parameters:
spread_instrument (Instrument) – The spread instrument to generate quotes for.
handler (Callable[[QuoteTick], None]) – The quote handler callback that receives generated spread quotes.
greeks_calculator (GreeksCalculator) – The greeks calculator for calculating option greeks (required for option spreads).
clock (Clock) – The clock for timing operations and timer management.
historical (bool) – Whether the aggregator is processing historical data. When True, the clock is advanced independently with incoming data timestamps.
update_interval_seconds (int | None, default None) – The interval in seconds for timer-driven quote building. If None, uses quote-driven mode (builds immediately when all legs have quotes). If an integer, uses timer-driven mode (reads from internal state at the specified interval).
quote_build_delay (int, default 0) – The time delay (microseconds) before building and emitting a quote.
- Raises:
ValueError – If spread_instrument has one or fewer legs.
- handle_quote_tick(self, QuoteTick tick) void¶
- historical_mode¶
‘bool’
- Type:
- is_running¶
‘bool’
- Type:
- set_clock(self, Clock clock) void¶
- set_historical_mode(self, bool historical_mode, handler: Callable[[QuoteTick], None], GreeksCalculator greeks_calculator) void¶
- set_running(self, bool is_running) void¶
- start_timer(self) void¶
- stop_timer(self) void¶
- class TickBarAggregator¶
Bases:
BarAggregatorTickBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building tick bars from ticks.
When received tick count reaches the step threshold of the bar specification, then a bar is created and sent to the handler.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (TradeTick) – The tick for the update.
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class TickImbalanceBarAggregator¶
Bases:
BarAggregatorTickImbalanceBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building tick imbalance bars from ticks.
When the absolute difference between buy and sell ticks reaches the step threshold of the bar specification, then a bar is created and sent to the handler.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class TickRunsBarAggregator¶
Bases:
BarAggregatorTickRunsBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building tick runs bars from ticks.
When consecutive ticks of the same aggressor side reach the step threshold of the bar specification, then a bar is created and sent to the handler. The run resets when the aggressor side changes.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class TimeBarAggregator¶
Bases:
BarAggregatorTimeBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None], Clock clock, str interval_type=’left-open’, bool timestamp_on_close=True, bool skip_first_non_full_bar=False, bool build_with_no_updates=True, time_bars_origin_offset: pd.Timedelta | pd.DateOffset = None, int bar_build_delay=0) -> None
Provides a means of building time bars from ticks with an internal timer.
When the time reaches the next time interval of the bar specification, then a bar is created and sent to the handler.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
clock (Clock) – The clock for the aggregator.
interval_type (str, default 'left-open') – Determines the type of interval used for time aggregation. - ‘left-open’: start time is excluded and end time is included (default). - ‘right-open’: start time is included and end time is excluded.
timestamp_on_close (bool, default True) – If True, then timestamp will be the bar close time. If False, then timestamp will be the bar open time.
skip_first_non_full_bar (bool, default False) – If will skip emitting a bar if the aggregation starts mid-interval.
build_with_no_updates (bool, default True) – If build and emit bars with no new market updates.
time_bars_origin_offset (pd.Timedelta or pd.DateOffset, optional) – The origin time offset.
bar_build_delay (int, default 0) – The time delay (microseconds) before building and emitting a composite bar type.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- first_close_ns¶
- get_start_time(self, datetime now: datetime) datetime¶
Return the start time for the aggregator’s next bar.
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (TradeTick) – The tick for the update.
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- interval¶
- interval_ns¶
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- next_close_ns¶
- set_clock(self, Clock clock) void¶
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- start_timer(self) void¶
- stop_timer(self) void¶
- stored_open_ns¶
- class ValueBarAggregator¶
Bases:
BarAggregatorValueBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building value bars from ticks.
When received value reaches the step threshold of the bar specification, then a bar is created and sent to the handler.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- get_cumulative_value(self)¶
Return the current cumulative value of the aggregator.
- Return type:
Decimal
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (TradeTick) – The tick for the update.
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class ValueImbalanceBarAggregator¶
Bases:
BarAggregatorValueImbalanceBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building value imbalance bars from ticks.
When the absolute difference between buy and sell notional value reaches the step threshold of the bar specification, then a bar is created and sent to the handler.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class ValueRunsBarAggregator¶
Bases:
BarAggregatorValueRunsBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building value runs bars from ticks.
When consecutive notional value of the same aggressor side reaches the step threshold of the bar specification, then a bar is created and sent to the handler. The run resets when the aggressor side changes.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class VolumeBarAggregator¶
Bases:
BarAggregatorVolumeBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building volume bars from ticks.
When received volume reaches the step threshold of the bar specification, then a bar is created and sent to the handler.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (TradeTick) – The tick for the update.
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class VolumeImbalanceBarAggregator¶
Bases:
BarAggregatorVolumeImbalanceBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building volume imbalance bars from ticks.
When the absolute difference between buy and sell volume reaches the step threshold of the bar specification, then a bar is created and sent to the handler.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- class VolumeRunsBarAggregator¶
Bases:
BarAggregatorVolumeRunsBarAggregator(Instrument instrument, BarType bar_type, handler: Callable[[Bar], None]) -> None
Provides a means of building volume runs bars from ticks.
When consecutive volume of the same aggressor side reaches the step threshold of the bar specification, then a bar is created and sent to the handler. The run resets when the aggressor side changes.
- Parameters:
instrument (Instrument) – The instrument for the aggregator.
bar_type (BarType) – The bar type for the aggregator.
handler (Callable[[Bar], None]) – The bar handler for the aggregator.
- Raises:
ValueError – If instrument.id != bar_type.instrument_id.
- bar_type¶
The aggregators bar type.
- Returns:
BarType
- handle_bar(self, Bar bar) void¶
Update the aggregator with the given bar.
- Parameters:
bar (Bar) – The bar for the update.
- handle_quote_tick(self, QuoteTick tick) void¶
Update the aggregator with the given tick.
- Parameters:
tick (QuoteTick) – The tick for the update.
- handle_trade_tick(self, TradeTick tick) void¶
- historical_mode¶
If the aggregator is processing historical data.
- Returns:
bool
- is_running¶
If the aggregator is receiving data from the message bus.
- Returns:
bool
- set_historical_mode(self, bool historical_mode, handler: Callable[[Bar], None]) void¶
Set the historical mode state of the aggregator.
- Parameters:
historical_mode (bool) – Whether the aggregator is processing historical data.
handler (Callable[[Bar], None]) – The bar handler to use in this mode.
- Raises:
TypeError – If handler is
Noneor not callable.
- set_running(self, bool is_running) void¶
Set the running state of the aggregator.
- Parameters:
is_running (bool) – Whether the aggregator is running (receiving data from message bus).
- find_closest_smaller_time(now: pd.Timestamp, daily_time_origin: pd.Timedelta, period: pd.Timedelta) pd.Timestamp¶
Find the closest bar start_time <= now
Client¶
- class DataClient¶
Bases:
ComponentDataClient(ClientId client_id, MessageBus msgbus, Cache cache, Clock clock, Venue venue: Venue | None = None, config: NautilusConfig | None = None)
The base class for all data clients.
- Parameters:
client_id (ClientId) – The data client ID.
msgbus (MessageBus) – The message bus for the client.
clock (Clock) – The clock for the client.
venue (Venue, optional) – The client venue. If multi-venue then can be
None.config (NautilusConfig, optional) – The configuration for the instance.
Warning
This class should not be used directly, but through a concrete subclass.
- degrade(self) void¶
Degrade the component.
While executing on_degrade() any exception will be logged and reraised, then the component will remain in a
DEGRADINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- dispose(self) void¶
Dispose of the component.
While executing on_dispose() any exception will be logged and reraised, then the component will remain in a
DISPOSINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- fault(self) void¶
Fault the component.
Calling this method multiple times has the same effect as calling it once (it is idempotent). Once called, it cannot be reversed, and no other methods should be called on this instance.
While executing on_fault() any exception will be logged and reraised, then the component will remain in a
FAULTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- classmethod fully_qualified_name(cls) str¶
Return the fully qualified name for the components class.
- Return type:
str
References
- id¶
The components ID.
- Returns:
ComponentId
- is_connected¶
If the client is connected.
- Returns:
bool
- is_degraded¶
bool
Return whether the current component state is
DEGRADED.- Return type:
bool
- Type:
- is_disposed¶
bool
Return whether the current component state is
DISPOSED.- Return type:
bool
- Type:
- is_faulted¶
bool
Return whether the current component state is
FAULTED.- Return type:
bool
- Type:
- is_initialized¶
bool
Return whether the component has been initialized (component.state >=
INITIALIZED).- Return type:
bool
- Type:
- is_running¶
bool
Return whether the current component state is
RUNNING.- Return type:
bool
- Type:
- is_stopped¶
bool
Return whether the current component state is
STOPPED.- Return type:
bool
- Type:
- request(self, RequestData request) void¶
Request data for the given data type.
- Parameters:
request (RequestData) – The message for the data request.
- reset(self) void¶
Reset the component.
All stateful fields are reset to their initial value.
While executing on_reset() any exception will be logged and reraised, then the component will remain in a
RESETTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- resume(self) void¶
Resume the component.
While executing on_resume() any exception will be logged and reraised, then the component will remain in a
RESUMINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- shutdown_system(self, str reason=None) void¶
Initiate a system-wide shutdown by generating and publishing a ShutdownSystem command.
The command is handled by the system’s NautilusKernel, which will invoke either stop (synchronously) or stop_async (asynchronously) depending on the execution context and the presence of an active event loop.
- Parameters:
reason (str, optional) – The reason for issuing the shutdown command.
- start(self) void¶
Start the component.
While executing on_start() any exception will be logged and reraised, then the component will remain in a
STARTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- state¶
ComponentState
Return the components current state.
- Return type:
ComponentState
- Type:
- stop(self) void¶
Stop the component.
While executing on_stop() any exception will be logged and reraised, then the component will remain in a
STOPPINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- subscribe(self, SubscribeData command) void¶
Subscribe to data for the given data type.
- Parameters:
data_type (DataType) – The data type for the subscription.
- subscribed_custom_data(self) list¶
Return the custom data types subscribed to.
- Return type:
list[DataType]
- trader_id¶
The trader ID associated with the component.
- Returns:
TraderId
- type¶
The components type.
- Returns:
type
- unsubscribe(self, UnsubscribeData command) void¶
Unsubscribe from data for the given data type.
- Parameters:
data_type (DataType) – The data type for the subscription.
- venue¶
The clients venue ID (if applicable).
- Returns:
Venue or
None
- class MarketDataClient¶
Bases:
DataClientMarketDataClient(ClientId client_id, MessageBus msgbus, Cache cache, Clock clock, Venue venue: Venue | None = None, config: NautilusConfig | None = None)
The base class for all market data clients.
- Parameters:
client_id (ClientId) – The data client ID.
msgbus (MessageBus) – The message bus for the client.
cache (Cache) – The cache for the client.
clock (Clock) – The clock for the client.
venue (Venue, optional) – The client venue. If multi-venue then can be
None.config (NautilusConfig, optional) – The configuration for the instance.
Warning
This class should not be used directly, but through a concrete subclass.
- degrade(self) void¶
Degrade the component.
While executing on_degrade() any exception will be logged and reraised, then the component will remain in a
DEGRADINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- dispose(self) void¶
Dispose of the component.
While executing on_dispose() any exception will be logged and reraised, then the component will remain in a
DISPOSINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- fault(self) void¶
Fault the component.
Calling this method multiple times has the same effect as calling it once (it is idempotent). Once called, it cannot be reversed, and no other methods should be called on this instance.
While executing on_fault() any exception will be logged and reraised, then the component will remain in a
FAULTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- classmethod fully_qualified_name(cls) str¶
Return the fully qualified name for the components class.
- Return type:
str
References
- id¶
The components ID.
- Returns:
ComponentId
- is_connected¶
If the client is connected.
- Returns:
bool
- is_degraded¶
bool
Return whether the current component state is
DEGRADED.- Return type:
bool
- Type:
- is_disposed¶
bool
Return whether the current component state is
DISPOSED.- Return type:
bool
- Type:
- is_faulted¶
bool
Return whether the current component state is
FAULTED.- Return type:
bool
- Type:
- is_initialized¶
bool
Return whether the component has been initialized (component.state >=
INITIALIZED).- Return type:
bool
- Type:
- is_running¶
bool
Return whether the current component state is
RUNNING.- Return type:
bool
- Type:
- is_stopped¶
bool
Return whether the current component state is
STOPPED.- Return type:
bool
- Type:
- request(self, RequestData request) void¶
Request data for the given data type.
- Parameters:
request (RequestData) – The message for the data request.
- request_bars(self, RequestBars request) void¶
Request historical Bar data. To load historical data from a catalog, you can pass a list[DataCatalogConfig] to the TradingNodeConfig or the BacktestEngineConfig.
- Parameters:
request (RequestBars) – The message for the data request.
- request_funding_rates(self, RequestFundingRates request) void¶
Request historical FundingRateUpdate data.
- Parameters:
request (RequestFundingRates) – The message for the data request.
- request_instrument(self, RequestInstrument request) void¶
Request Instrument data for the given instrument ID.
- Parameters:
request (RequestInstrument) – The message for the data request.
- request_instruments(self, RequestInstruments request) void¶
Request all Instrument data for the given venue.
- Parameters:
request (RequestInstruments) – The message for the data request.
- request_order_book_deltas(self, RequestOrderBookDeltas request) void¶
Request historical OrderBookDeltas data.
- Parameters:
request (RequestOrderBookDeltas) – The message for the data request.
- request_order_book_snapshot(self, RequestOrderBookSnapshot request) void¶
Request order book snapshot data.
- Parameters:
request (RequestOrderBookSnapshot) – The message for the data request.
- request_quote_ticks(self, RequestQuoteTicks request) void¶
Request historical QuoteTick data.
- Parameters:
request (RequestQuoteTicks) – The message for the data request.
- request_trade_ticks(self, RequestTradeTicks request) void¶
Request historical TradeTick data.
- Parameters:
request (RequestTradeTicks) – The message for the data request.
- reset(self) void¶
Reset the component.
All stateful fields are reset to their initial value.
While executing on_reset() any exception will be logged and reraised, then the component will remain in a
RESETTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- resume(self) void¶
Resume the component.
While executing on_resume() any exception will be logged and reraised, then the component will remain in a
RESUMINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- shutdown_system(self, str reason=None) void¶
Initiate a system-wide shutdown by generating and publishing a ShutdownSystem command.
The command is handled by the system’s NautilusKernel, which will invoke either stop (synchronously) or stop_async (asynchronously) depending on the execution context and the presence of an active event loop.
- Parameters:
reason (str, optional) – The reason for issuing the shutdown command.
- start(self) void¶
Start the component.
While executing on_start() any exception will be logged and reraised, then the component will remain in a
STARTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- state¶
ComponentState
Return the components current state.
- Return type:
ComponentState
- Type:
- stop(self) void¶
Stop the component.
While executing on_stop() any exception will be logged and reraised, then the component will remain in a
STOPPINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- subscribe(self, SubscribeData command) void¶
Subscribe to data for the given data type.
- Parameters:
data_type (DataType) – The data type for the subscription.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_bars(self, SubscribeBars command) void¶
Subscribe to Bar data for the given bar type.
- Parameters:
bar_type (BarType) – The bar type to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_funding_rates(self, SubscribeFundingRates command) void¶
Subscribe to FundingRateUpdate data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_index_prices(self, SubscribeIndexPrices command) void¶
Subscribe to IndexPriceUpdate data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_instrument(self, SubscribeInstrument command) void¶
Subscribe to the Instrument with the given instrument ID.
- Parameters:
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_instrument_close(self, SubscribeInstrumentClose command) void¶
Subscribe to InstrumentClose updates for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The tick instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_instrument_status(self, SubscribeInstrumentStatus command) void¶
Subscribe to InstrumentStatus data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The tick instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_instruments(self, SubscribeInstruments command) void¶
Subscribe to all Instrument data.
- Parameters:
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_mark_prices(self, SubscribeMarkPrices command) void¶
Subscribe to MarkPriceUpdate data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_order_book_deltas(self, SubscribeOrderBook command) void¶
Subscribe to OrderBookDeltas data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The order book instrument to subscribe to.
book_type (BookType {
L1_MBP,L2_MBP,L3_MBO}) – The order book type.depth (int, optional, default None) – The maximum depth for the subscription.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_order_book_depth(self, SubscribeOrderBook command) void¶
Subscribe to OrderBookDepth10 data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The order book instrument to subscribe to.
depth (int, optional) – The maximum depth for the order book (defaults to 10).
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_quote_ticks(self, SubscribeQuoteTicks command) void¶
Subscribe to QuoteTick data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The tick instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribe_trade_ticks(self, SubscribeTradeTicks command) void¶
Subscribe to TradeTick data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The tick instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- subscribed_custom_data(self) list¶
Return the custom data types subscribed to.
- Return type:
list[DataType]
- subscribed_funding_rates(self) list¶
Return the funding rate update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_index_prices(self) list¶
Return the index price update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_instrument_close(self) list¶
Return the instrument closes subscribed to.
- Return type:
list[InstrumentId]
- subscribed_instrument_status(self) list¶
Return the status update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_instruments(self) list¶
Return the instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_mark_prices(self) list¶
Return the mark price update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_order_book_deltas(self) list¶
Return the order book delta instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_order_book_depth(self) list¶
Return the order book depth instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_quote_ticks(self) list¶
Return the quote tick instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_trade_ticks(self) list¶
Return the trade tick instruments subscribed to.
- Return type:
list[InstrumentId]
- trader_id¶
The trader ID associated with the component.
- Returns:
TraderId
- type¶
The components type.
- Returns:
type
- unsubscribe(self, UnsubscribeData command) void¶
Unsubscribe from data for the given data type.
- Parameters:
data_type (DataType) – The data type for the subscription.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_bars(self, UnsubscribeBars command) void¶
Unsubscribe from Bar data for the given bar type.
- Parameters:
bar_type (BarType) – The bar type to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_funding_rates(self, UnsubscribeFundingRates command) void¶
Unsubscribe from FundingRateUpdate data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_index_prices(self, UnsubscribeIndexPrices command) void¶
Unsubscribe from IndexPriceUpdate data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_instrument(self, UnsubscribeInstrument command) void¶
Unsubscribe from Instrument data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_instrument_close(self, UnsubscribeInstrumentClose command) void¶
Unsubscribe from InstrumentClose data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The tick instrument to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_instrument_status(self, UnsubscribeInstrumentStatus command) void¶
Unsubscribe from InstrumentStatus data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument status updates to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_instruments(self, UnsubscribeInstruments command) void¶
Unsubscribe from all Instrument data.
- Parameters:
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_mark_prices(self, UnsubscribeMarkPrices command) void¶
Unsubscribe from MarkPriceUpdate data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The instrument to subscribe to.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_order_book_deltas(self, UnsubscribeOrderBook command) void¶
Unsubscribe from OrderBookDeltas data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The order book instrument to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_order_book_depth(self, UnsubscribeOrderBook command) void¶
Unsubscribe from OrderBookDepth10 data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The order book instrument to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_quote_ticks(self, UnsubscribeQuoteTicks command) void¶
Unsubscribe from QuoteTick data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The tick instrument to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- unsubscribe_trade_ticks(self, UnsubscribeTradeTicks command) void¶
Unsubscribe from TradeTick data for the given instrument ID.
- Parameters:
instrument_id (InstrumentId) – The tick instrument to unsubscribe from.
params (dict[str, Any], optional) – Additional params for the subscription.
- venue¶
The clients venue ID (if applicable).
- Returns:
Venue or
None
Engine¶
The DataEngine is the central component of the entire data stack.
The data engines primary responsibility is to orchestrate interactions between the DataClient instances, and the rest of the platform. This includes sending requests to, and receiving responses from, data endpoints via its registered data clients.
The engine employs a simple fan-in fan-out messaging pattern to execute DataCommand type messages, and process DataResponse messages or market data objects.
Alternative implementations can be written on top of the generic engine - which just need to override the execute, process, send and receive methods.
- class DataEngine¶
Bases:
ComponentDataEngine(MessageBus msgbus, Cache cache, Clock clock, config: DataEngineConfig | None = None) -> None
Provides a high-performance data engine for managing many DataClient instances, for the asynchronous ingest of data.
- Parameters:
msgbus (MessageBus) – The message bus for the engine.
cache (Cache) – The cache for the engine.
clock (Clock) – The clock for the engine.
config (DataEngineConfig, optional) – The configuration for the instance.
- check_connected(self) bool¶
Check all of the engines clients are connected.
- Returns:
True if all clients connected, else False.
- Return type:
bool
- check_disconnected(self) bool¶
Check all of the engines clients are disconnected.
- Returns:
True if all clients disconnected, else False.
- Return type:
bool
- command_count¶
The total count of data commands received by the engine.
- Returns:
int
- connect(self) None¶
Connect the engine by calling connect on all registered clients.
- data_count¶
The total count of data stream objects received by the engine.
- Returns:
int
- debug¶
If debug mode is active (will provide extra debug logging).
- Returns:
bool
- default_client¶
ClientId | None
Return the default data client registered with the engine.
- Return type:
ClientId or
None- Type:
- degrade(self) void¶
Degrade the component.
While executing on_degrade() any exception will be logged and reraised, then the component will remain in a
DEGRADINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- deregister_client(self, DataClient client) void¶
Deregister the given data client from the data engine.
- Parameters:
client (DataClient) – The data client to deregister.
- disconnect(self) None¶
Disconnect the engine by calling disconnect on all registered clients.
- dispose(self) void¶
Dispose of the component.
While executing on_dispose() any exception will be logged and reraised, then the component will remain in a
DISPOSINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- execute(self, DataCommand command) void¶
Execute the given data command.
- Parameters:
command (DataCommand) – The command to execute.
- fault(self) void¶
Fault the component.
Calling this method multiple times has the same effect as calling it once (it is idempotent). Once called, it cannot be reversed, and no other methods should be called on this instance.
While executing on_fault() any exception will be logged and reraised, then the component will remain in a
FAULTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- classmethod fully_qualified_name(cls) str¶
Return the fully qualified name for the components class.
- Return type:
str
References
- get_external_client_ids(self) set¶
Returns the configured external client order IDs.
- Return type:
set[ClientId]
- id¶
The components ID.
- Returns:
ComponentId
- is_degraded¶
bool
Return whether the current component state is
DEGRADED.- Return type:
bool
- Type:
- is_disposed¶
bool
Return whether the current component state is
DISPOSED.- Return type:
bool
- Type:
- is_faulted¶
bool
Return whether the current component state is
FAULTED.- Return type:
bool
- Type:
- is_initialized¶
bool
Return whether the component has been initialized (component.state >=
INITIALIZED).- Return type:
bool
- Type:
- is_running¶
bool
Return whether the current component state is
RUNNING.- Return type:
bool
- Type:
- is_stopped¶
bool
Return whether the current component state is
STOPPED.- Return type:
bool
- Type:
- process(self, Data data, bool historical=False) void¶
Process the given data.
- Parameters:
data (Data) – The data to process.
- process_historical(self, Data data) void¶
Process historical data.
- Parameters:
data (Data) – The historical data to process.
- register_catalog(self, catalog: ParquetDataCatalog, str name: str = 'catalog_0') None¶
Register the given data catalog with the engine.
- Parameters:
catalog (ParquetDataCatalog) – The data catalog to register.
name (str, default 'catalog_0') – The name of the catalog to register.
- register_client(self, DataClient client) void¶
Register the given data client with the data engine.
- Parameters:
client (DataClient) – The client to register.
- Raises:
ValueError – If client is already registered.
- register_default_client(self, DataClient client) void¶
Register the given client as the default routing client (when a specific venue routing cannot be found).
Any existing default routing client will be overwritten.
- Parameters:
client (DataClient) – The client to register.
- register_venue_routing(self, DataClient client, Venue venue) void¶
Register the given client to route messages to the given venue.
Any existing client in the routing map for the given venue will be overwritten.
- Parameters:
venue (Venue) – The venue to route messages to.
client (DataClient) – The client for the venue routing.
- registered_clients¶
list[ClientId]
Return the execution clients registered with the engine.
- Return type:
list[ClientId]
- Type:
- request(self, RequestData request) void¶
Handle the given request.
- Parameters:
request (RequestData) – The request to handle.
- request_count¶
The total count of data requests received by the engine.
- Returns:
int
- reset(self) void¶
Reset the component.
All stateful fields are reset to their initial value.
While executing on_reset() any exception will be logged and reraised, then the component will remain in a
RESETTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- response(self, DataResponse response) void¶
Handle the given response.
- Parameters:
response (DataResponse) – The response to handle.
- response_count¶
The total count of data responses received by the engine.
- Returns:
int
- resume(self) void¶
Resume the component.
While executing on_resume() any exception will be logged and reraised, then the component will remain in a
RESUMINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- routing_map¶
dict[Venue, DataClient]
Return the default data client registered with the engine.
- Return type:
ClientId or
None- Type:
- shutdown_system(self, str reason=None) void¶
Initiate a system-wide shutdown by generating and publishing a ShutdownSystem command.
The command is handled by the system’s NautilusKernel, which will invoke either stop (synchronously) or stop_async (asynchronously) depending on the execution context and the presence of an active event loop.
- Parameters:
reason (str, optional) – The reason for issuing the shutdown command.
- start(self) void¶
Start the component.
While executing on_start() any exception will be logged and reraised, then the component will remain in a
STARTINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- state¶
ComponentState
Return the components current state.
- Return type:
ComponentState
- Type:
- stop(self) void¶
Stop the component.
While executing on_stop() any exception will be logged and reraised, then the component will remain in a
STOPPINGstate.Warning
Do not override.
If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
- stop_clients(self) void¶
Stop the registered clients.
- subscribed_custom_data(self) list¶
Return the custom data types subscribed to.
- Return type:
list[DataType]
- subscribed_funding_rates(self) list¶
Return the funding rate update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_index_prices(self) list¶
Return the index price update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_instrument_close(self) list¶
Return the close price instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_instrument_status(self) list¶
Return the status update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_instruments(self) list¶
Return the instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_mark_prices(self) list¶
Return the mark price update instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_order_book_deltas(self) list¶
Return the order book delta instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_order_book_depth(self) list¶
Return the order book depth instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_quote_ticks(self) list¶
Return the quote tick instruments subscribed to.
- Return type:
list[InstrumentId]
- subscribed_synthetic_quotes(self) list¶
Return the synthetic instrument quotes subscribed to.
- Return type:
list[InstrumentId]
- subscribed_synthetic_trades(self) list¶
Return the synthetic instrument trades subscribed to.
- Return type:
list[InstrumentId]
- subscribed_trade_ticks(self) list¶
Return the trade tick instruments subscribed to.
- Return type:
list[InstrumentId]
- trader_id¶
The trader ID associated with the component.
- Returns:
TraderId
- type¶
The components type.
- Returns:
type
- class SnapshotInfo¶
Bases:
object
- default_time_range_generator(RequestData request)¶
Generator that yields (request_start_ns, request_end_ns) tuples for subrequests.
This generator handles the duration logic and receives data_received feedback via .send().
- get_time_range_generator(str name: str)¶
- register_time_range_generator(str name: str, function: TimeRangeGenerator)¶
Messages¶
- class DataCommand¶
Bases:
CommandDataCommand(DataType data_type, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
The base class for all data commands.
- Parameters:
data_type (type) – The data type for the command.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the command.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
Warning
This class should not be used directly, but through a concrete subclass.
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class DataResponse¶
Bases:
ResponseDataResponse(ClientId client_id: ClientId | None, Venue venue: Venue | None, DataType data_type, data, UUID4 correlation_id, UUID4 response_id, uint64_t ts_init, datetime start, datetime end, dict params: dict | None = None) -> None
Represents a response with data.
- Parameters:
client_id (ClientId or
None) – The data client ID of the response.venue (Venue or
None) – The venue for the response.data_type (type) – The data type of the response.
data (object) – The data of the response.
correlation_id (UUID4) – The correlation ID.
response_id (UUID4) – The response ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
start (datetime) – The start datetime (UTC) of response time range (inclusive).
end (datetime) – The end datetime (UTC) of response time range (inclusive).
params (dict[str, object], optional) – Additional parameters for the response.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the response.
- Returns:
ClientId or
None
- correlation_id¶
The response correlation ID.
- Returns:
UUID4
- data¶
The response data.
- Returns:
object
- data_type¶
The response data type.
- Returns:
type
- end¶
The end datetime (UTC) of response time range.
- id¶
The response message ID.
- Returns:
UUID4
- params¶
Additional specific parameters for the response.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of response time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the response.
- Returns:
Venue or
None
- class RequestBars¶
Bases:
RequestDataRequestBars(BarType bar_type, datetime start: datetime | None, datetime end: datetime | None, int limit, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for bars.
- Parameters:
bar_type (BarType) – The bar type for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
limit (int) – The limit on the amount of bars received.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- bar_type¶
The bar type for the request.
- Returns:
BarType
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestData¶
Bases:
RequestRequestData(DataType data_type, InstrumentId instrument_id: InstrumentId | None, datetime start: datetime | None, datetime end: datetime | None, int limit, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for data.
- Parameters:
data_type (type) – The data type for the request.
instrument_id (InstrumentId) – The instrument ID for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
limit (int) – The limit on the amount of data to return for the request.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestFundingRates¶
Bases:
RequestDataRequestFundingRates(InstrumentId instrument_id, datetime start: datetime | None, datetime end: datetime | None, int limit, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for funding rates.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
limit (int) – The limit on the amount of trade ticks received.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestInstrument¶
Bases:
RequestDataRequestInstrument(InstrumentId instrument_id, datetime start: datetime | None, datetime end: datetime | None, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestInstruments¶
Bases:
RequestDataRequestInstruments(datetime start: datetime | None, datetime end: datetime | None, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for instruments.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestJoin¶
Bases:
RequestDataRequestJoin(tuple request_ids, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request to join multiple data requests.
- Parameters:
request_ids (tuple[UUID4]) – The tuple of sub-request IDs to join.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- request_ids¶
The tuple of sub-request IDs.
- Returns:
tuple[UUID4]
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestOrderBookDeltas¶
Bases:
RequestDataRequestOrderBookDeltas(InstrumentId instrument_id, datetime start: datetime | None, datetime end: datetime | None, int limit, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for historical OrderBookDeltas data.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
limit (int) – The limit on the amount of deltas received.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestOrderBookDepth¶
Bases:
RequestDataRequestOrderBookDepth(InstrumentId instrument_id, datetime start: datetime | None, datetime end: datetime | None, int limit, int depth, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for historical OrderBookDepth10 data.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
limit (int) – The limit on the amount of depth snapshots received.
depth (int) – The maximum depth for the order book depth data (default is 10).
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- depth¶
The maximum depth for the order book depths.
- Returns:
int
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestOrderBookSnapshot¶
Bases:
RequestDataRequestOrderBookSnapshot(InstrumentId instrument_id, int limit, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for an order book snapshot.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the request.
limit (int) – The limit on the depth of the order book snapshot (default is None).
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestQuoteTicks¶
Bases:
RequestDataRequestQuoteTicks(InstrumentId instrument_id, datetime start: datetime | None, datetime end: datetime | None, int limit, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for quote ticks.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
limit (int) – The limit on the amount of quote ticks received.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class RequestTradeTicks¶
Bases:
RequestDataRequestTradeTicks(InstrumentId instrument_id, datetime start: datetime | None, datetime end: datetime | None, int limit, ClientId client_id: ClientId | None, Venue venue: Venue | None, callback: Callable[[Any], None] | None, UUID4 request_id, uint64_t ts_init, dict params: dict | None, UUID4 correlation_id=None) -> None
Represents a request for trade ticks.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the request.
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
limit (int) – The limit on the amount of trade ticks received.
client_id (ClientId or
None) – The data client ID for the request.venue (Venue or
None) – The venue for the request.callback (Callable[[Any], None]) – The delegate to call with the data.
request_id (UUID4) – The request ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object]) – Additional parameters for the request.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- callback¶
The callback for the response.
- Returns:
Callable
- client_id¶
The data client ID for the request.
- Returns:
ClientId or
None
- correlation_id¶
The request correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The request data type.
- Returns:
type
- end¶
The end datetime (UTC) of request time range.
- id¶
The request message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the request.
- Returns:
InstrumentId
- limit¶
The limit on the amount of data to return for the request.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- start¶
The start datetime (UTC) of request time range (inclusive).
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the request.
- Returns:
Venue or
None
- with_dates(self, datetime start, datetime end, uint64_t ts_init, callback: Callable[[Any], None] | None = None)¶
- class SubscribeBars¶
Bases:
SubscribeDataSubscribeBars(BarType bar_type, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to bars for an instrument.
- Parameters:
bar_type (BarType) – The bar type for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- bar_type¶
The bar type for the subscription.
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestBars¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeData¶
Bases:
DataCommandSubscribeData(DataType data_type, InstrumentId instrument_id: InstrumentId | None, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to data.
- Parameters:
data_type (type) – The data type for the subscription.
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestData¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeFundingRates¶
Bases:
SubscribeDataSubscribeFundingRates(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to funding rates.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestData¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeIndexPrices¶
Bases:
SubscribeDataSubscribeIndexPrices(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to index prices.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestData¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeInstrument¶
Bases:
SubscribeDataSubscribeInstrument(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestData¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeInstrumentClose¶
Bases:
SubscribeDataSubscribeInstrumentClose(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to the close of an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestData¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeInstrumentStatus¶
Bases:
SubscribeDataSubscribeInstrumentStatus(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to the status of an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestData¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeInstruments¶
Bases:
SubscribeDataSubscribeInstruments(ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to all instruments of a venue.
- Parameters:
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestInstruments¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeMarkPrices¶
Bases:
SubscribeDataSubscribeMarkPrices(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to mark prices.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestData¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeOrderBook¶
Bases:
SubscribeDataSubscribeOrderBook(InstrumentId instrument_id, type book_data_type, BookType book_type, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, int depth=0, bool managed=True, int interval_ms=0, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to order book deltas for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
data_type (DataType, {
OrderBookDeltas,OrderBookDepth10}) – The data type for book updates.book_type (BookType) – The order book type.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
depth (int, optional, default 0) – The maximum depth for the subscription.
managed (bool, optional, default True) – If an order book should be managed by the data engine based on the subscribed feed.
interval_ms (int, default 0 (no interval snapshots)) – The interval (milliseconds) between snapshots.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).ValueError – If interval_ms is negative (< 0).
- book_type¶
The order book type.
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- depth¶
The maximum depth for the subscription.
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- interval_ms¶
The order book snapshot interval in milliseconds (must be positive for snapshots).
- managed¶
If an order book should be managed by the data engine based on the subscribed feed.
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestOrderBookDepth | RequestOrderBookDeltas¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- Raises:
ValueError – If the data type is neither OrderBookDepth10 nor OrderBookDelta.
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeQuoteTicks¶
Bases:
SubscribeDataSubscribeQuoteTicks(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to quote ticks.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestQuoteTicks¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class SubscribeTradeTicks¶
Bases:
SubscribeDataSubscribeTradeTicks(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to subscribe to trade ticks.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- to_request(self, datetime start: datetime | None, datetime end: datetime | None, callback: Callable[[Any], None] | None) RequestTradeTicks¶
Convert this subscribe message to a request message.
- Parameters:
start (datetime) – The start datetime (UTC) of request time range (inclusive).
end (datetime) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
callback (Callable[[Any], None]) – The delegate to call with the data.
- Returns:
The converted request message.
- Return type:
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeBars¶
Bases:
UnsubscribeDataUnsubscribeBars(BarType bar_type, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from bars for an instrument.
- Parameters:
bar_type (BarType) – The bar type for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- bar_type¶
The bar type for the subscription.
- Returns:
BarType
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeData¶
Bases:
DataCommandUnsubscribeData(DataType data_type, InstrumentId instrument_id: InstrumentId | None, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe to data.
- Parameters:
data_type (type) – The data type for the subscription.
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeFundingRates¶
Bases:
UnsubscribeDataUnsubscribeFundingRates(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from funding rates for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeIndexPrices¶
Bases:
UnsubscribeDataUnsubscribeIndexPrices(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from index prices for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeInstrument¶
Bases:
UnsubscribeDataUnsubscribeInstrument(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe to an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeInstrumentClose¶
Bases:
UnsubscribeDataUnsubscribeInstrumentClose(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from instrument close for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeInstrumentStatus¶
Bases:
UnsubscribeDataUnsubscribeInstrumentStatus(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from instrument status.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeInstruments¶
Bases:
UnsubscribeDataUnsubscribeInstruments(ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe to all instruments.
- Parameters:
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeMarkPrices¶
Bases:
UnsubscribeDataUnsubscribeMarkPrices(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from mark prices for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeOrderBook¶
Bases:
UnsubscribeDataUnsubscribeOrderBook(InstrumentId instrument_id, type book_data_type, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from order book updates for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
book_data_type (type, {
OrderBookDelta,OrderBookDepth10}) – The data type for book updates.client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeQuoteTicks¶
Bases:
UnsubscribeDataUnsubscribeQuoteTicks(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from quote ticks for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None
- class UnsubscribeTradeTicks¶
Bases:
UnsubscribeDataUnsubscribeTradeTicks(InstrumentId instrument_id, ClientId client_id: ClientId | None, Venue venue: Venue | None, UUID4 command_id, uint64_t ts_init, dict params: dict | None = None, UUID4 correlation_id=None) -> None
Represents a command to unsubscribe from trade ticks for an instrument.
- Parameters:
instrument_id (InstrumentId) – The instrument ID for the subscription.
client_id (ClientId or
None) – The data client ID for the command.venue (Venue or
None) – The venue for the command.command_id (UUID4) – The command ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
params (dict[str, object], optional) – Additional parameters for the subscription.
- Raises:
ValueError – If both client_id and venue are both
None(not enough routing info).
- client_id¶
The data client ID for the command.
- Returns:
ClientId or
None
- correlation_id¶
The command correlation ID.
- Returns:
UUID4 or
None
- data_type¶
The command data type.
- Returns:
type
- id¶
The command message ID.
- Returns:
UUID4
- instrument_id¶
The instrument ID for the subscription.
- Returns:
InstrumentId or
None
- params¶
Additional specific parameters for the command.
- Returns:
dict[str, object] or
None
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- venue¶
The venue for the command.
- Returns:
Venue or
None