Skip to main content

parse_trade_tick

Function parse_trade_tick 

Source
pub fn parse_trade_tick(
    trade: &DerivePublicTrade,
    price_precision: u8,
    size_precision: u8,
    ts_init: UnixNanos,
) -> Result<TradeTick>
Expand description

Parses a public trade message into a Nautilus trade tick.

Public rows carry the participant’s direction. It maps directly to the aggressor side when the participant role is absent, unrecognized, or taker. Maker rows use the opposite direction.

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 if trade identifier, price, size, or timestamp conversion fails.