Skip to main content

Module indicative

Module indicative 

Source
Expand description

Decoding indicative_market_data frames, batched or not.

crate::WsClient::subscribe_indicative_market_data subscribes to indicative_market_data_v2, whose IndicativeMarketDataBatch frames each hold several rows oldest first. With batching disabled, or against a server that predates the v2 channel, it uses indicative_market_data, where each row arrives as its own IndicativeMarketData frame. The helpers here return the rows in delivery order either way, so applying them in order gives the same per-instrument state regardless of framing.

use hypercall_client::indicative::decode_indicative_rows;

let frame = r#"{"type":"IndicativeMarketDataBatch","flushed_at":2,"updates":[
    {"instrument":"BTC-20261002-87000-C","best_bid":"14.79","best_ask":"133.88",
     "num_providers":1,"published_at":1,"timestamp":1}]}"#;
let rows = decode_indicative_rows(frame).unwrap().expect("indicative frame");
assert_eq!(rows[0].instrument, "BTC-20261002-87000-C");

Functionsยง

decode_indicative_rows
Decode one text frame and return its indicative rows, or None for any other message type.
indicative_rows
Rows carried by one server message, or None if it is not indicative market data.
indicative_rows_from_value
decode_indicative_rows for a message already collected by crate::WsClient (see crate::WsClient::get_messages).