Skip to main content

derive_trade_id

Function derive_trade_id 

Source
pub fn derive_trade_id(
    symbol: Ustr,
    ts_event_ns: u64,
    price: f64,
    amount: f64,
    side: &str,
) -> TradeId
Expand description

Derives a deterministic [TradeId] from trade fields.

Tardis records do not always carry a venue-provided trade ID (some venues publish empty strings or omit the field entirely). This hash combines the symbol, timestamp, price, amount and side so replayed data yields the same identifier across runs. FNV-1a is stable across architectures and crate versions; the 0x1f delimiter keeps variable-length fields from colliding.