Skip to main content

parse_ws_fill_report_fast

Function parse_ws_fill_report_fast 

Source
pub fn parse_ws_fill_report_fast(
    execution: &BybitWsAccountExecutionFast,
    account_id: AccountId,
    instrument: &InstrumentAny,
    fee_rates: Option<MakerTakerFeeRates>,
    client_order_id: Option<ClientOrderId>,
    venue_position_id: Option<PositionId>,
    ts_init: UnixNanos,
) -> Result<FillReport>
Expand description

Parses a fast-stream WebSocket execution payload into a [FillReport].

The execution.fast channel omits fee and exec-type fields. Commission is derived from the supplied account fee rates and is not venue-authoritative. A charged Linear fee rounds up at the settlement currency precision, as the venue fee does. Liquidity side is derived from isMaker.

client_order_id takes precedence over the payload’s orderLinkId. The execution client supplies the identity it correlates by venue order ID for maker fills.

venue_position_id should be supplied for tracked hedge-mode orders so the emitted report carries the long/short position identity that the standard channel preserves via OrderFilled.

§Errors

Returns an error if:

  • Price or quantity fields cannot be parsed or timestamps are invalid.
  • The commission cannot be derived: fee_rates is None, the calculation fails, or the execution is an Option fill, whose payload lacks the inputs required by Bybit’s Option fee formula.