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,
    size: i64,
    side: Option<BitmexSide>,
) -> TradeId
Expand description

Derives a deterministic [TradeId] for BitMEX trades that arrive without a trdMatchID (e.g. certain historical or bucketed rows).

The hash combines the symbol, timestamp, price, size 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.