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
| Field | Rust type | Python type | Required/default | Notes |
|---|---|---|---|---|
instrument_id | InstrumentId | InstrumentId | Required | Instrument whose book is represented. |
bids | [BookOrder; 10] | list[BookOrder] | Required | Exactly 10 bid levels. |
asks | [BookOrder; 10] | list[BookOrder] | Required | Exactly 10 ask levels. |
bid_counts | [u32; 10] | list[int] | Required | Number of bid orders at each level. |
ask_counts | [u32; 10] | list[int] | Required | Number of ask orders at each level. |
flags | u8 | int | Required | RecordFlag bit field for event metadata. |
sequence | u64 | int | Required | Venue sequence number, or zero if absent. |
ts_event | UnixNanos | int | Required | Event timestamp in nanoseconds. |
ts_init | UnixNanos | int | Required | Initialization 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
OrderBookDeltastreams.
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),
);Related guides
- QuoteTick covers top-of-book data derived from depth.
- Order books explains order book state.
- Python API Reference lists Python members.
OrderBookDeltas
OrderBookDeltas groups a non-empty batch of OrderBookDelta records that belong to the same logical book event. It reduces per-message overhead when adapters...
QuoteTick
QuoteTick represents the top-of-book bid and ask for one instrument. It carries the best available bid price and size, and the best available ask price and...