parse_instrument_msg

Function parse_instrument_msg 

Source
pub fn parse_instrument_msg(
    msg: BitmexInstrumentMsg,
    instruments_cache: &AHashMap<Ustr, InstrumentAny>,
    ts_init: UnixNanos,
) -> Vec<Data>
Expand description

Parse a BitMEX WebSocket instrument message for mark and index prices.

For index symbols (e.g., .BXBT):

  • Uses the lastPrice field as the index price.
  • Also emits the markPrice field (which equals lastPrice for indices).

For regular instruments:

  • Uses the index_price field for index price updates.
  • Uses the mark_price field for mark price updates.

Returns a Vec of Data containing mark and/or index price updates or an empty Vec if no relevant price is present.