Skip to main content

parse_trade_tick_from_rest

Function parse_trade_tick_from_rest 

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

Parses a public participant trade row into a Nautilus trade tick.

Public rows can pair maker and taker participants under the same trade_id. Each row’s direction is that participant’s side: the aggressor side is the taker row’s direction and the inverse of the maker row’s. An absent or unrecognized role treats direction as the taker’s 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 if trade identifier, price, size, or timestamp conversion fails.