Skip to content

Stock Market Value

Streams the calculated market value for one stock, delivered as a MarketValue event. Each update carries the calculated market_bid, market_ask, and market_price.

The snippets below assume a connected client with streaming started — see Getting Started for the connect-and-stream ladder.

rust
use thetadatadx::streaming::Contract;
use thetadatadx::streaming::{StreamData, StreamEvent};

client.stream().start_streaming(|event: &StreamEvent| {
    if let StreamEvent::Data(StreamData::MarketValue { contract, market_price, .. }) = event {
        println!("{} market_price={market_price}", contract.symbol);
    }
})?;

let sub = Contract::stock("AAPL").market_value();
client.stream().subscribe(sub.clone())?;

// Remove this stream; the session stays open for other subscriptions.
client.stream().unsubscribe(sub)?;

MarketValue event fields

Each update arrives as a MarketValue event with these fields:

FieldTypeDescription
contractcontractResolved contract identity (symbol, security type, and option fields).
ms_of_dayi32Milliseconds since midnight Eastern Time.
market_bidf64Calculated market-value bid (stocks and options only).
market_askf64Calculated market-value ask (stocks and options only).
market_pricef64Calculated market value; the only populated value for an index.
datei32Trading date as a YYYYMMDD integer.
received_at_nsu64Local receive timestamp, nanoseconds since the Unix epoch.

The contract field carries symbol, the security type, and — for options — expiration, right, and the strike. See Handling Events for the full event catalogue and per-language field shapes.

WebSocket frame

The native SDK callbacks (Rust/Python/TypeScript/C++) receive every field above. Each raw WebSocket frame (the Server tab) is { "header": {…}, "contract": {…}, "market_value": {…} }: header and contract are always present, while the market_value payload object carries only the terminal-compatible subset: ms_of_day, market_bid, market_ask, market_price, date. The remaining event fields are delivered to the SDK callbacks, not the market_value payload object.

Released under the Apache-2.0 License.