Option Full Trades
Streams every option trade print across the entire OPRA universe — one subscription, no per-contract management. Each execution delivers a Trade event; read the contract identity off the event.
The snippets below assume a connected client with streaming started — see Getting Started for the connect-and-stream ladder.
rust
use thetadatadx::fpss::protocol::SecTypeExt;
use thetadatadx::fpss::{FpssData, FpssEvent};
use thetadatadx::SecType;
tdx.start_streaming(|event: &FpssEvent| {
if let FpssEvent::Data(FpssData::Trade { contract, price, size, .. }) = event {
println!("{} price={price} size={size}", contract.symbol);
}
})?;
let sub = SecType::Option.full_trades();
tdx.subscribe(sub.clone())?;
// Remove this stream; the session stays open for other subscriptions.
tdx.unsubscribe(sub)?;python
from thetadatadx import SecType
def on_event(event):
if event.kind == "trade":
print(event.contract.symbol, event.price, event.size)
tdx.start_streaming(on_event)
sub = SecType.OPTION.full_trades()
tdx.subscribe(sub)
# Remove this stream; the session stays open for other subscriptions.
tdx.unsubscribe(sub)typescript
import { SecType } from 'thetadatadx';
tdx.startStreaming((event) => {
if (event.kind === 'trade') {
const e = event.trade!;
console.log(e.contract.symbol, e.price, e.size);
}
});
const sub = SecType.option().fullTrades();
tdx.subscribe(sub);
// Remove this stream; the session stays open for other subscriptions.
tdx.unsubscribe(sub);cpp
client.set_callback([](const tdx::FpssEvent& event) {
if (event.kind == TDX_FPSS_TRADE) {
auto& e = event.trade;
std::cout << e.contract.symbol << " price=" << e.price << " size=" << e.size << "\n";
}
});
auto sub = tdx::SecType::option().full_trades();
client.subscribe(sub);
// Remove this stream; the session stays open for other subscriptions.
client.unsubscribe(sub);http
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
bash
websocat ws://127.0.0.1:25520/v1/events
{"msg_type": "STREAM", "sec_type": "OPTION", "req_type": "FULL_TRADES", "id": 1, "add": true}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. |
ext_condition1 | i32 | Additional trade condition code. |
ext_condition2 | i32 | Additional trade condition code. |
ext_condition3 | i32 | Additional trade condition code. |
ext_condition4 | i32 | Additional trade condition code. |
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. |
condition_flags | i32 | Trade condition flags bitmap. |
price_flags | i32 | Trade price flags bitmap. |
volume_type | i32 | Volume reporting mode: 0 = incremental, 1 = cumulative. |
records_back | i32 | Offset of this record behind the most recent record. |
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.