Skip to content

OHLC

FreeValueStandardPro

Get the latest OHLC snapshot for one or more indices.

  • Retrieves the real-time current day OHLC.
  • Exchanges typically generate a price report every second for popular indices like SPX.
rust
pub fn index_snapshot_ohlc(&self, symbols: &[&str]) -> IndexSnapshotOhlcBuilder<'_>

Optional parameters chain on the builder: .min_time(&str). Execute with .awaitResult<Vec<OhlcTick>, Error>, or decode chunk-by-chunk with .stream(handler).

Example

rust
let rows = tdx.index_snapshot_ohlc(&["SPX"]).await?;
for t in &rows {
    println!("date={} open={} high={} low={} close={}", t.date, t.open, t.high, t.low, t.close);
}

Parameters

NameTypeRequiredDefaultDescription
symbolsymbolsyesComma-separated ticker symbols (e.g. AAPL,MSFT)
min_timestringnoMinimum time filter
timeout_msintnoPer-request deadline in milliseconds. 0 means no deadline.

Response

Rows of OhlcTick:

FieldTypeDescription
ms_of_dayi32Opening time of the bar, milliseconds since midnight ET.
openf64Opening trade price.
highf64Highest traded price.
lowf64Lowest traded price.
closef64Closing traded price.
volumei64Number of contracts or shares traded.
counti64Number of trades.
vwapf64Volume-weighted average price of the session.
datei32Trading date as a YYYYMMDD integer.

Released under the Apache-2.0 License.