Stock Quotes
Streams every NBBO update for one stock. Each change to the national best bid or offer delivers a Quote event to the registered callback.
The snippets below assume a connected client with streaming started — see Getting Started for the connect-and-stream ladder.
rust
use thetadatadx::fpss::protocol::Contract;
use thetadatadx::fpss::{FpssData, FpssEvent};
tdx.start_streaming(|event: &FpssEvent| {
if let FpssEvent::Data(FpssData::Quote { contract, bid, ask, .. }) = event {
println!("{} bid={bid} ask={ask}", contract.symbol);
}
})?;
let sub = Contract::stock("AAPL").quote();
tdx.subscribe(sub.clone())?;
// Remove this stream; the session stays open for other subscriptions.
tdx.unsubscribe(sub)?;Event fields
Each update arrives as a Quote event with these fields:
| Field | Type | Description |
|---|---|---|
contract | contract | Resolved contract identity (symbol, security type, and option fields). |
ms_of_day | i32 | Milliseconds since midnight Eastern Time. |
bid_size | i32 | Last NBBO bid size. |
bid_exchange | i32 | Exchange code of the NBBO bid. |
bid | f64 | Last NBBO bid price. |
bid_condition | i32 | Quote condition code on the bid side. |
ask_size | i32 | Last NBBO ask size. |
ask_exchange | i32 | Exchange code of the NBBO ask. |
ask | f64 | Last NBBO ask price. |
ask_condition | i32 | Quote condition code on the ask side. |
date | i32 | Trading date as a YYYYMMDD integer. |
received_at_ns | u64 | Local 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.