Skip to main content

parse_orderbook_deltas

Function parse_orderbook_deltas 

Source
pub fn parse_orderbook_deltas(
    msg: &DeriveOrderbookMsg,
    price_precision: u8,
    size_precision: u8,
    ts_init: UnixNanos,
) -> Result<OrderBookDeltas>
Expand description

Parses an order book snapshot message into Nautilus snapshot deltas.

Derive’s grouped order book stream sends a full depth snapshot for the requested grouping and depth, so the output starts with a clear delta and marks the last add with F_LAST. The payload does not include a change ID, so this uses the feed timestamp as the snapshot sequence.

Pass price and size precision from the instrument definition rather than inferring them from the wire values, since Derive may trim trailing zeroes.

§Errors

Returns an error when a price, size, or timestamp cannot be converted.