NautilusTrader
ConceptsData
These docs track the unreleased nightly build and may change without notice. Switch to the latest stable docs.

OrderBookDepth10

OrderBookDepth10 represents a fixed-depth book update with up to 10 bid levels and 10 ask levels. It is useful when a venue publishes a self-contained depth snapshot rather than incremental deltas.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredInstrument whose book is represented.
bids[BookOrder; 10]list[BookOrder]RequiredExactly 10 bid levels.
asks[BookOrder; 10]list[BookOrder]RequiredExactly 10 ask levels.
bid_counts[u32; 10]list[int]RequiredNumber of bid orders at each level.
ask_counts[u32; 10]list[int]RequiredNumber of ask orders at each level.
flagsu8intRequiredRecordFlag bit field for event metadata.
sequenceu64intRequiredVenue sequence number, or zero if absent.
ts_eventUnixNanosintRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosintRequiredInitialization timestamp in nanoseconds.

Behavior

  • Rust and PyO3 Python constructors require exactly 10 bid levels, 10 ask levels, 10 bid counts, and 10 ask counts.
  • Use null or default book orders with zero counts for unavailable levels.
  • This type is not interchangeable with incremental OrderBookDelta streams.

Example

use nautilus_core::UnixNanos;
use nautilus_model::{
    data::{BookOrder, OrderBookDepth10, DEPTH10_LEN},
    enums::OrderSide,
    identifiers::InstrumentId,
    types::{Price, Quantity},
};

let mut bids = [BookOrder::default(); DEPTH10_LEN];
let mut asks = [BookOrder::default(); DEPTH10_LEN];
bids[0] = BookOrder::new(OrderSide::Buy, Price::from("2500.10"), Quantity::from("3.5"), 1);
asks[0] = BookOrder::new(OrderSide::Sell, Price::from("2500.20"), Quantity::from("2.0"), 2);

let depth = OrderBookDepth10::new(
    InstrumentId::from("ETHUSDT-PERP.BINANCE"),
    bids,
    asks,
    [1; DEPTH10_LEN],
    [1; DEPTH10_LEN],
    0,
    42,
    UnixNanos::from(1_000_000_000),
    UnixNanos::from(1_000_000_100),
);

On this page