Skip to content

stock_snapshot_ohlc

Latest OHLC (open-high-low-close) snapshot for one or more stocks. Returns the current or most recent trading session's aggregated bar.

FreeValueStandardPro

Code Example

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

Parameters

symbolsstring[]required
One or more ticker symbols
venuestringoptional
Data venue filter
min_timestringoptional
Minimum time of day as milliseconds from midnight ET

Response Fields (OhlcTick)

ms_of_dayi32
Bar start time (milliseconds from midnight ET)
open / high / low / closef64
OHLC prices (decoded at parse time).
volumei64
Total volume in the bar
counti64
Number of trades in the bar
datei32
Date as YYYYMMDD integer

Sample Response

json
[
  {"date": 20260402, "ms_of_day": 71999485, "open": 367.20, "high": 373.60, "low": 364.15, "close": 373.46, "volume": 18370273, "count": 440751},
  {"date": 20260402, "ms_of_day": 71983113, "open": 254.14, "high": 256.13, "low": 250.65, "close": 255.92, "volume": 24286541, "count": 407209},
  {"date": 20260402, "ms_of_day": 71998357, "open": 646.42, "high": 657.92, "low": 645.11, "close": 655.94, "volume": 38832397, "count": 510918}
]

Notes

  • Accepts multiple symbols in a single call. Batch requests to reduce round-trips.
  • All price fields are f64 -- decoded during parsing.

Released under the Apache-2.0 License.