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 bars: Vec<OhlcTick> = tdx.stock_snapshot_ohlc(&["AAPL", "MSFT"]).await?;
for bar in &bars {
println!("O={} H={} L={} C={} V={}",
bar.open_price(), bar.high_price(),
bar.low_price(), bar.close_price(), bar.volume);
}python
bars = tdx.stock_snapshot_ohlc(["AAPL", "MSFT"])
for bar in bars:
print(f"O={bar['open']:.2f} H={bar['high']:.2f} "
f"L={bar['low']:.2f} C={bar['close']:.2f}")go
bars, err := client.StockSnapshotOHLC([]string{"AAPL", "MSFT"})
if err != nil {
log.Fatal(err)
}
for _, bar := range bars {
fmt.Printf("O=%.2f H=%.2f L=%.2f C=%.2f V=%d\n",
bar.Open, bar.High, bar.Low, bar.Close, bar.Volume)
}cpp
auto bars = client.stock_snapshot_ohlc({"AAPL", "MSFT"});
for (auto& bar : bars) {
std::cout << "O=" << bar.open << " H=" << bar.high
<< " L=" << bar.low << " C=" << bar.close
<< " V=" << bar.volume << std::endl;
}Parameters
symbolsstring[]requiredOne or more ticker symbols
venuestringoptionalData venue filter
min_timestringoptionalMinimum time of day as milliseconds from midnight ET
Response Fields (OhlcTick)
ms_of_dayi32Bar start time (milliseconds from midnight ET)
open / high / low / closei32Fixed-point OHLC prices. Use
open_price(), high_price(), low_price(), close_price() for decoded values.volumei32Total volume in the bar
counti32Number of trades in the bar
price_typei32Decimal type for price decoding
datei32Date as
YYYYMMDD integerNotes
- Accepts multiple symbols in a single call. Batch requests to reduce round-trips.
- Prices are stored as fixed-point integers. Use the helper methods to get decoded float values.