Data Utilities

class FuseMarketDepth(tick_size, lot_size)[source]

This combines the real-time Level-1 book ticker stream with the conflated Level-2 depth stream to produce the most frequent and granular depth events possible.

Parameters:
  • tick_size (float64) – tick size for the asset being processed.

  • lot_size (float64) – lot size for the asset being processed.

close()[source]

Releases resources associated with this FuseMarketDepth instance.

This method must be called to free the underlying memory allocated by the native implementation.

Return type:

None

process_event(ev, index, add)[source]

Processes a market event at the given index.

Parameters:
  • ev (ndarray[Any, dtype([('ev', '<u8'), ('exch_ts', '<i8'), ('local_ts', '<i8'), ('px', '<f8'), ('qty', '<f8'), ('order_id', '<u8'), ('ival', '<i8'), ('fval', '<f8')], align=True)]) – The array of events to process.

  • index (uint64) – The index of the event in the array to process.

  • add (bool) – If True, the event is added to the fused events. If False, the event is used to update market depth for future processing, but is not included in the fused output.

Return type:

None

property fused_events: ndarray[Any, dtype(['ev', '<u8', 'exch_ts', '<i8', 'local_ts', '<i8', 'px', '<f8', 'qty', '<f8', 'order_id', '<u8', 'ival', '<i8', 'fval', '<f8'], align=True)]

Returns the array of fused events generated so far.