Skip to content

option_snapshot_ohlc

FreeValueStandardPro

Get the latest OHLC (open, high, low, close) snapshot for an option contract.

Code Example

rust
let data = tdx.option_snapshot_ohlc("SPY", "20260417", "550", "C").await?;
for t in &data {
    println!("date={} ms_of_day={} open={:.2} high={:.2} low={:.2} close={:.2} volume={} expiration={} strike={:.2}",
        t.date, t.ms_of_day, t.open, t.high, t.low, t.close, t.volume, t.expiration, t.strike);
}
python
data = tdx.option_snapshot_ohlc("SPY", "20260417", "550", "C")
for t in data:
    print(f"date={t.date} ms_of_day={t.ms_of_day} open={t.open:.2f} high={t.high:.2f} "
          f"low={t.low:.2f} close={t.close:.2f} volume={t.volume} expiration={t.expiration} strike={t.strike:.2f}")
typescript
const data = tdx.optionSnapshotOhlc('SPY', '20260417', '550', 'C');
for (const t of data) {
    console.log(`date=${t.date} ms_of_day=${t.ms_of_day} open=${t.open} high=${t.high} low=${t.low} close=${t.close}`);
}
cpp
auto data = client.option_snapshot_ohlc("SPY", "20260417", "550", "C");
for (const auto& t : data) {
    printf("date=%d ms_of_day=%d open=%.2f high=%.2f low=%.2f close=%.2f volume=%d expiration=%d strike=%.2f\n",
        t.date, t.ms_of_day, t.open, t.high, t.low, t.close, t.volume, t.expiration, t.strike);
}

Parameters

symbolstringrequired
Underlying symbol
expirationstringrequired
Expiration date in YYYYMMDD format
strikestringrequired
Strike price in dollars as a string (e.g. "500" or "17.5")
rightstringrequired
"C" for call, "P" for put
max_dteintoptional
Maximum days to expiration
strike_rangeintoptional
Strike range filter
min_timestringoptional
Minimum time of day as milliseconds from midnight

Response

openfloat
Opening price
highfloat
High price
lowfloat
Low price
closefloat
Closing price
volumeint
Volume
datestring
Date
ms_of_dayint
Milliseconds from midnight

Sample Response

json
[
  {"date": 20260402, "ms_of_day": 34203497, "open": 98.59, "high": 98.59, "low": 98.59, "close": 98.59, "volume": 1, "expiration": 20260417, "strike": 550.0}
]

SPY 2026-04-17 550 call OHLC snapshot. Wildcard queries return multiple contracts with expiration, strike, and right fields populated.

Released under the Apache-2.0 License.