Skip to content

index_snapshot_ohlc

FreeValueStandardPro

Get the latest OHLC (open, high, low, close) snapshot for one or more index symbols. Returns the most recent bar data.

Code Example

rust
let data = tdx.index_snapshot_ohlc(&["SPX", "VIX"]).await?;
for t in &data {
    println!("date={} ms_of_day={} open={:.2} high={:.2} low={:.2} close={:.2} volume={}",
        t.date, t.ms_of_day, t.open, t.high, t.low, t.close, t.volume);
}
python
data = tdx.index_snapshot_ohlc(["SPX", "VIX"])
for t in data:
    print(f"date={t.date} ms_of_day={t.ms_of_day} open={t.open:.2f} "
          f"high={t.high:.2f} low={t.low:.2f} close={t.close:.2f} volume={t.volume}")
typescript
const data = tdx.indexSnapshotOhlc(['SPX', 'VIX']);
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.index_snapshot_ohlc({"SPX", "VIX"});
for (const auto& t : data) {
    printf("date=%d ms_of_day=%d open=%.2f high=%.2f low=%.2f close=%.2f volume=%d\n",
        t.date, t.ms_of_day, t.open, t.high, t.low, t.close, t.volume);
}

Parameters

symbolsstring[]required
One or more index symbols
min_timestringoptional
Minimum time of day as milliseconds from midnight

Response

openf64
Opening price
highf64
High price
lowf64
Low price
closef64
Closing price
volumeu64
Volume
countu32
Number of trades in bar
ms_of_dayu32
Milliseconds from midnight ET
dateu32
Date as YYYYMMDD integer

Sample Response

json
[
  {"date": 20260402, "ms_of_day": 57600000, "open": 6820.51, "high": 6916.23, "low": 6785.14, "close": 6899.87, "volume": 0},
  {"date": 20260402, "ms_of_day": 57600000, "open": 21045.88, "high": 21312.15, "low": 20891.34, "close": 21256.72, "volume": 0}
]

OHLC snapshot for SPX and NDX. Indices do not have volume data.

Notes

  • Pass multiple symbols in a single call to batch requests efficiently.
  • During market hours, the snapshot reflects the current partial bar.

Released under the Apache-2.0 License.