Skip to main content

parse_ws_fill_report

Function parse_ws_fill_report 

Source
pub fn parse_ws_fill_report(
    trade: &LighterTrade,
    account_index: i64,
    instrument: &InstrumentAny,
    account_id: AccountId,
    ts_init: UnixNanos,
) -> Result<Option<FillReport>>
Expand description

Parses a Lighter account-trade payload into a [FillReport] when the trade involves the supplied account.

Returns Ok(None) if account_index is neither the bid nor ask account on the trade. The handler routes account-stream trades through this helper, so crossed pairs the user is not part of (e.g. when sharing a market with other participants) are skipped silently rather than misattributed.

ยงErrors

Returns an error if any price, size, or timestamp field cannot be converted.