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.

The public WS feed defines direction as the taker’s direction, so it maps directly to the aggressor side.

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