Skip to main content

parse_recent_trade

Function parse_recent_trade 

Source
pub fn parse_recent_trade(
    trade: &HyperliquidRecentTrade,
    instrument: &InstrumentAny,
) -> Result<TradeTick>
Expand description

Parses a recentTrades info entry into a [TradeTick].

Mirrors the field mapping of the WebSocket trade parser parse_ws_trade_tick: both the trades channel and the recentTrades endpoint carry the same px/sz/side/time/tid fields. For this historical snapshot ts_init is set to the trade’s ts_event (venue time), matching the other request converters so the data engine’s window trimming keeps bounded requests.

§Errors

Returns an error if the price, size, trade identifier, or timestamp is invalid.