Skip to content

Option Full Trades

Streams every option trade print across the entire OPRA universe — one subscription, no per-contract management. For each traded contract the stream delivers more than the trade: a Quote (the last NBBO) and an Ohlcvc bar arrive before the Trade print, and the next two NBBO Quote updates for that contract arrive after it. Read the contract identity 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::Option.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 NBBO) and the Ohlcvc bar are sent automatically before the trade occurs, then the Trade follows. The next two NBBO updates for that contract then arrive as Quote events after the trade. 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 20231110 P 360.00  bid/ask (last NBBO)
ohlcvc QQQ 20231110 P 360.00  open/high/low/close, volume, count
trade  QQQ 20231110 P 360.00  price, size, exchange, condition
quote  QQQ 20231110 P 360.00  (next NBBO)
quote  QQQ 20231110 P 360.00  (next NBBO)

The Ohlcvc bar and the trailing Quote updates carry the same contract. ThetaData encodes the option strike in tenths of a cent (a $360.00 strike as 360000); the server's WebSocket emits that integer verbatim by default, while the native SDK resolves it to the dollar strike on event.contract.

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 an Options 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.
  • The server's WebSocket envelope takes the option strike as the terminal's 1/10-cent integer by default (--strike-format dollars switches to a dollar value); the native SDK builders take dollars.

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 NBBO bid size.
bid_exchangei32Exchange code of the NBBO bid.
bidf64Last NBBO bid price.
bid_conditioni32Quote condition code on the bid side.
ask_sizei32Last NBBO ask size.
ask_exchangei32Exchange code of the NBBO ask.
askf64Last NBBO 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.