Skip to content

Stock Full Trades

Streams every trade print across the entire stock universe — one subscription, no per-symbol management. For each traded symbol the stream delivers three events, not just the trade: a Quote (the last BBO), an Ohlcvc bar, and then the Trade print itself. Read the symbol off each event's contract.

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

rust
use thetadatadx::streaming::SecTypeExt;
use thetadatadx::streaming::{StreamData, StreamEvent};
use thetadatadx::SecType;

client.stream().start_streaming(|event: &StreamEvent| match event {
    StreamEvent::Data(StreamData::Quote { contract, bid, ask, .. }) => {
        println!("{} quote bid={bid} ask={ask}", contract.symbol);
    }
    StreamEvent::Data(StreamData::Ohlcvc { contract, open, high, low, close, .. }) => {
        println!("{} bar o={open} h={high} l={low} c={close}", contract.symbol);
    }
    StreamEvent::Data(StreamData::Trade { contract, price, size, .. }) => {
        println!("{} trade price={price} size={size}", contract.symbol);
    }
    _ => {}
})?;

let sub = SecType::Stock.full_trades();
client.stream().subscribe(sub.clone())?;

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

What the stream delivers

This is not a trade-only feed. For every traded contract the stream delivers three event types: a Quote, an Ohlcvc bar, and the Trade print. The Quote (the last BBO) and the Ohlcvc bar are sent automatically before the trade occurs, then the Trade follows. Narrow on event.kind (quote / ohlcvc / trade) to handle each, and read the contract identity off every event's contract.

Per-contract sequence

text
quote  QQQ  bid/ask (last BBO)
ohlcvc QQQ  open/high/low/close, volume, count
trade  QQQ  price, size, exchange, condition

OHLC bars

The Ohlcvc bars on this stream come from upstream automatically — one is sent for each traded contract before its trade, you do not subscribe to them separately.

Before you subscribe

  • This stream requires a Stocks Pro subscription.
  • Each new stream request must use a higher id than the last; reusing an id stops the terminal from automatically resubscribing your earlier streams after a reconnect. The SDK manages the id for you; the WebSocket envelope sets it explicitly.

Quote event fields

Each update arrives as a Quote event with these fields:

FieldTypeDescription
contractcontractResolved contract identity (symbol, security type, and option fields).
ms_of_dayi32Milliseconds since midnight Eastern Time.
bid_sizei32Last BBO bid size.
bid_exchangei32Exchange code of the BBO bid.
bidf64Last BBO bid price.
bid_conditioni32Quote condition code on the bid side.
ask_sizei32Last BBO ask size.
ask_exchangei32Exchange code of the BBO ask.
askf64Last BBO ask price.
ask_conditioni32Quote condition code on the ask side.
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.

Ohlcvc event fields

Each update arrives as a Ohlcvc event with these fields:

FieldTypeDescription
contractcontractResolved contract identity (symbol, security type, and option fields).
ms_of_dayi32Milliseconds since midnight Eastern Time.
openf64Opening trade price of the bar.
highf64Highest traded price of the bar.
lowf64Lowest traded price of the bar.
closef64Closing traded price of the bar.
volumei64Number of contracts or shares traded in the bar.
counti64Number of trades in the bar.
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.

Trade event fields

Each update arrives as a Trade event with these fields:

FieldTypeDescription
contractcontractResolved contract identity (symbol, security type, and option fields).
ms_of_dayi32Milliseconds since midnight Eastern Time.
sequencei32Exchange-assigned trade sequence number.
conditioni32Trade condition code.
sizei32Number of contracts or shares traded.
exchangei32Exchange code where the trade executed.
pricef64Trade price.
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": {…}, "trade": {…} }: header and contract are always present, while the trade payload object carries only the terminal-compatible subset: ms_of_day, sequence, size, condition, price, exchange, date. The remaining event fields are delivered to the SDK callbacks, not the trade payload object.

Released under the Apache-2.0 License.