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.
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)?;from thetadatadx import SecType
def on_event(event):
if event.kind == "quote":
print(event.contract.symbol, "quote", event.bid, event.ask)
elif event.kind == "ohlcvc":
print(event.contract.symbol, "bar", event.open, event.high, event.low, event.close)
elif event.kind == "trade":
print(event.contract.symbol, "trade", event.price, event.size)
client.stream.start_streaming(on_event)
sub = SecType.OPTION.full_trades()
client.stream.subscribe(sub)
# Remove this stream; the session stays open for other subscriptions.
client.stream.unsubscribe(sub)import { SecType } from 'thetadatadx-ts';
await client.stream.startStreaming((event) => {
switch (event.kind) {
case 'quote': {
const q = event.quote!;
console.log(q.contract.symbol, 'quote', q.bid, q.ask);
break;
}
case 'ohlcvc': {
const b = event.ohlcvc!;
console.log(b.contract.symbol, 'bar', b.open, b.high, b.low, b.close);
break;
}
case 'trade': {
const t = event.trade!;
console.log(t.contract.symbol, 'trade', t.price, t.size);
break;
}
}
});
const sub = SecType.option().fullTrades();
client.stream.subscribe(sub);
// Remove this stream; the session stays open for other subscriptions.
client.stream.unsubscribe(sub);client.stream().set_callback([](const thetadatadx::StreamEvent& event) {
switch (event.kind) {
case THETADATADX_STREAM_QUOTE:
std::cout << event.quote.contract.symbol << " quote bid=" << event.quote.bid << " ask=" << event.quote.ask << "\n";
break;
case THETADATADX_STREAM_OHLCVC:
std::cout << event.ohlcvc.contract.symbol << " bar o=" << event.ohlcvc.open << " c=" << event.ohlcvc.close << "\n";
break;
case THETADATADX_STREAM_TRADE:
std::cout << event.trade.contract.symbol << " trade price=" << event.trade.price << " size=" << event.trade.size << "\n";
break;
default:
break;
}
});
auto sub = thetadatadx::SecType::option().full_trades();
client.stream().subscribe(sub);
// Remove this stream; the session stays open for other subscriptions.
client.stream().unsubscribe(sub);GET ws://127.0.0.1:25520/v1/eventsWebSocket streaming from the bundled server binary. Send one JSON envelope per command; set "add": false to unsubscribe.
Example
websocat ws://127.0.0.1:25520/v1/events
{"msg_type": "STREAM", "sec_type": "OPTION", "req_type": "FULL_TRADES", "id": 1, "add": true}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
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
idthan the last; reusing anidstops the terminal from automatically resubscribing your earlier streams after a reconnect. The SDK manages theidfor 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 dollarsswitches to a dollar value); the native SDK builders take dollars.
Quote 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.
Ohlcvc event fields
Each update arrives as a Ohlcvc 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. |
open | f64 | Opening trade price of the bar. |
high | f64 | Highest traded price of the bar. |
low | f64 | Lowest traded price of the bar. |
close | f64 | Closing traded price of the bar. |
volume | i64 | Number of contracts or shares traded in the bar. |
count | i64 | Number of trades in the bar. |
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.
Trade event fields
Each update arrives as a Trade 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. |
sequence | i32 | Exchange-assigned trade sequence number. |
condition | i32 | Trade condition code. |
size | i32 | Number of contracts or shares traded. |
exchange | i32 | Exchange code where the trade executed. |
price | f64 | Trade price. |
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.
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.