Skip to content

OHLC

FreeValueStandardPro

Fetch intraday OHLC bars for an index.

  • Aggregated OHLC bars that use SIP rules for each bar.
  • Time timestamp of the bar represents the opening time of the bar. For a trade to be part of the bar: bar timestamp <= trade time < bar timestamp + interval.
  • Exchanges typically generate a price report every second for popular indices like SPX.
rust
pub fn index_history_ohlc(
    &self,
    symbol: &str,
    start_date: &str,
    end_date: &str,
) -> IndexHistoryOhlcBuilder<'_>

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

Example

rust
let rows = tdx
    .index_history_ohlc("SPX", "20250303", "20250306")
    .interval("1m")
    .await?;
for t in &rows {
    println!("date={} open={} high={} low={} close={}", t.date, t.open, t.high, t.low, t.close);
}

Parameters

NameTypeRequiredDefaultDescription
symbolstringyesTicker symbol (e.g. AAPL)
start_datedateyesStart date YYYYMMDD
end_datedateyesEnd date YYYYMMDD
intervalstringno1sInterval preset or millisecond string. Defaults to 1s when omitted — matching the upstream ThetaData Python library. Accepted values: tick, 10ms, 100ms, 500ms, 1s, 5s, 10s, 15s, 30s, 1m, 5m, 10m, 15m, 30m, 1h.
start_timestringno09:30:00Start time filter
end_timestringno16:00:00End 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.