Historical Data
All historical data is accessed through the ThetaDataDx client, which communicates over gRPC with ThetaData's MDDS servers. Every call runs through compiled Rust - gRPC, protobuf parsing, zstd decompression, and FIT decoding all happen at native speed, regardless of which SDK you use.
Connecting
use thetadatadx::{ThetaDataDx, Credentials, DirectConfig};
let creds = Credentials::from_file("creds.txt")?;
let client = ThetaDataDx::connect(&creds, DirectConfig::production()).await?;from thetadatadx import Credentials, Config, ThetaDataDx
creds = Credentials.from_file("creds.txt")
client = ThetaDataDx(creds, Config.production())creds, _ := thetadatadx.CredentialsFromFile("creds.txt")
defer creds.Close()
config := thetadatadx.ProductionConfig()
defer config.Close()
client, err := thetadatadx.Connect(creds, config)
if err != nil {
log.Fatal(err)
}
defer client.Close()auto creds = tdx::Credentials::from_file("creds.txt");
auto client = tdx::Client::connect(creds, tdx::Config::production());Date Format
All dates are YYYYMMDD strings: "20240315" for March 15, 2024.
Interval Format
Intervals are millisecond strings: "60000" for 1 minute, "300000" for 5 minutes, "3600000" for 1 hour.
DataFrame Support (Python)
All data methods have _df variants that return pandas DataFrames directly:
df = client.stock_history_eod_df("AAPL", "20240101", "20240301")Or convert any result explicitly:
from thetadatadx import to_dataframe
eod = client.stock_history_eod("AAPL", "20240101", "20240301")
df = to_dataframe(eod)Requires pip install thetadatadx[pandas].
Stock Endpoints (14)
List
// All available stock symbols
let symbols: Vec<String> = client.stock_list_symbols().await?;
// Available dates for a stock by request type
let dates: Vec<String> = client.stock_list_dates("EOD", "AAPL").await?;# All available stock symbols
symbols = client.stock_list_symbols()
# Available dates by request type
dates = client.stock_list_dates("EOD", "AAPL")// All stock symbols
symbols, _ := client.StockListSymbols()
// Available dates by request type
dates, _ := client.StockListDates("EOD", "AAPL")// All stock symbols
auto symbols = client.stock_list_symbols();
// Available dates by request type
auto dates = client.stock_list_dates("EOD", "AAPL");Snapshots
// Latest OHLC snapshot (one or more symbols)
let ticks: Vec<OhlcTick> = client.stock_snapshot_ohlc(&["AAPL", "MSFT"]).await?;
// Latest trade snapshot
let ticks: Vec<TradeTick> = client.stock_snapshot_trade(&["AAPL"]).await?;
// Latest NBBO quote snapshot
let ticks: Vec<QuoteTick> = client.stock_snapshot_quote(&["AAPL", "MSFT", "GOOGL"]).await?;
for q in &ticks {
println!("bid={} ask={}", q.bid_price(), q.ask_price());
}
// Latest market value snapshot
let ticks: Vec<MarketValueTick> = tdx.stock_snapshot_market_value(&["AAPL"]).await?;# Latest OHLC snapshot (one or more symbols)
ticks = client.stock_snapshot_ohlc(["AAPL", "MSFT"])
# Latest trade snapshot
ticks = client.stock_snapshot_trade(["AAPL"])
# Latest NBBO quote snapshot
ticks = client.stock_snapshot_quote(["AAPL", "MSFT", "GOOGL"])
# Latest market value
result = client.stock_snapshot_market_value(["AAPL"])// Latest quote snapshot (multiple symbols)
quotes, _ := client.StockSnapshotQuote([]string{"AAPL", "MSFT", "GOOGL"})
for _, q := range quotes {
fmt.Printf("bid=%.2f ask=%.2f\n", q.Bid, q.Ask)
}
ohlc, _ := client.StockSnapshotOHLC([]string{"AAPL", "MSFT"})
trades, _ := client.StockSnapshotTrade([]string{"AAPL"})
mv, _ := client.StockSnapshotMarketValue([]string{"AAPL"})// Latest quote snapshot (multiple symbols)
auto quotes = client.stock_snapshot_quote({"AAPL", "MSFT", "GOOGL"});
for (auto& q : quotes) {
std::cout << "bid=" << q.bid << " ask=" << q.ask << std::endl;
}
auto ohlc = client.stock_snapshot_ohlc({"AAPL", "MSFT"});
auto trades = client.stock_snapshot_trade({"AAPL"});
auto mv = client.stock_snapshot_market_value({"AAPL"});History
// End-of-day data for a date range
let eod: Vec<EodTick> = client.stock_history_eod("AAPL", "20240101", "20240301").await?;
for t in &eod {
println!("{}: O={} H={} L={} C={} V={}",
t.date, t.open_price(), t.high_price(),
t.low_price(), t.close_price(), t.volume);
}
// Intraday OHLC bars (single date)
let bars: Vec<OhlcTick> = client.stock_history_ohlc("AAPL", "20240315", "60000").await?;
// Intraday OHLC bars (date range)
let bars: Vec<OhlcTick> = client.stock_history_ohlc_range(
"AAPL", "20240101", "20240301", "300000" // 5-min bars
).await?;
// All trades for a date
let trades: Vec<TradeTick> = client.stock_history_trade("AAPL", "20240315").await?;
// NBBO quotes at a given interval (use "0" for every quote change)
let quotes: Vec<QuoteTick> = client.stock_history_quote("AAPL", "20240315", "60000").await?;
// Combined trade + quote ticks
let ticks: Vec<TradeQuoteTick> = tdx.stock_history_trade_quote("AAPL", "20240315").await?;# End-of-day data for a date range
eod = client.stock_history_eod("AAPL", "20240101", "20240301")
for tick in eod:
print(f"{tick['date']}: O={tick['open']:.2f} C={tick['close']:.2f} V={tick['volume']}")
# As DataFrame
df = client.stock_history_eod_df("AAPL", "20240101", "20240301")
print(df.describe())
# Intraday OHLC bars (single date)
bars = client.stock_history_ohlc("AAPL", "20240315", "60000")
print(f"{len(bars)} bars")
# Intraday OHLC bars (date range)
bars = client.stock_history_ohlc_range("AAPL", "20240101", "20240301", "300000")
# All trades for a date
trades = client.stock_history_trade("AAPL", "20240315")
print(f"{len(trades)} trades")
# NBBO quotes at a given interval
quotes = client.stock_history_quote("AAPL", "20240315", "60000")
df = client.stock_history_quote_df("AAPL", "20240315", "0")
# Combined trade + quote ticks
result = client.stock_history_trade_quote("AAPL", "20240315")// End-of-day data
eod, _ := client.StockHistoryEOD("AAPL", "20240101", "20240301")
for _, tick := range eod {
fmt.Printf("%d: O=%.2f H=%.2f L=%.2f C=%.2f V=%d\n",
tick.Date, tick.Open, tick.High, tick.Low, tick.Close, tick.Volume)
}
// Intraday OHLC bars
bars, _ := client.StockHistoryOHLC("AAPL", "20240315", "60000")
// OHLC bars across date range
bars, _ = client.StockHistoryOHLCRange("AAPL", "20240101", "20240301", "300000")
// All trades
trades, _ := client.StockHistoryTrade("AAPL", "20240315")
// NBBO quotes
quotes, _ := client.StockHistoryQuote("AAPL", "20240315", "60000")
// Combined trade + quote
result, _ := client.StockHistoryTradeQuote("AAPL", "20240315")// End-of-day data
auto eod = client.stock_history_eod("AAPL", "20240101", "20240301");
for (auto& tick : eod) {
std::cout << tick.date << ": O=" << tick.open
<< " H=" << tick.high << " L=" << tick.low
<< " C=" << tick.close << " V=" << tick.volume << std::endl;
}
// Intraday OHLC bars
auto bars = client.stock_history_ohlc("AAPL", "20240315", "60000");
// OHLC bars across date range
auto range_bars = client.stock_history_ohlc_range("AAPL", "20240101", "20240301", "300000");
// All trades
auto trades = client.stock_history_trade("AAPL", "20240315");
// NBBO quotes
auto quotes = client.stock_history_quote("AAPL", "20240315", "60000");
// Combined trade + quote
auto tq = client.stock_history_trade_quote("AAPL", "20240315");At-Time
Retrieve the trade or quote at a specific time of day across a date range. The time_of_day parameter is milliseconds from midnight ET (e.g., 34200000 = 9:30 AM).
// Trade at a specific time of day across a date range
let trades: Vec<TradeTick> = client.stock_at_time_trade(
"AAPL", "20240101", "20240301", "34200000"
).await?;
// Quote at a specific time of day across a date range
let quotes: Vec<QuoteTick> = client.stock_at_time_quote(
"AAPL", "20240101", "20240301", "34200000"
).await?;# Trade at a specific time of day across a date range
trades = client.stock_at_time_trade("AAPL", "20240101", "20240301", "34200000")
# Quote at a specific time of day
quotes = client.stock_at_time_quote("AAPL", "20240101", "20240301", "34200000")// Trade at 9:30 AM across a date range
trades, _ := client.StockAtTimeTrade("AAPL", "20240101", "20240301", "34200000")
// Quote at 9:30 AM
quotes, _ := client.StockAtTimeQuote("AAPL", "20240101", "20240301", "34200000")// Trade at 9:30 AM across a date range
auto trades = client.stock_at_time_trade("AAPL", "20240101", "20240301", "34200000");
// Quote at 9:30 AM
auto quotes = client.stock_at_time_quote("AAPL", "20240101", "20240301", "34200000");Streaming Large Responses (Rust)
For endpoints returning millions of rows, the Rust SDK provides _stream variants to process data chunk by chunk without holding everything in memory:
client.stock_history_trade_stream("AAPL", "20240315", |chunk| {
println!("Got {} trades in this chunk", chunk.len());
Ok(())
}).await?;
client.stock_history_quote_stream("AAPL", "20240315", "0", |chunk| {
println!("Got {} quotes in this chunk", chunk.len());
Ok(())
}).await?;Option Endpoints (34)
List
// All option underlying symbols
let symbols: Vec<String> = client.option_list_symbols().await?;
// Available dates for a specific contract
let dates: Vec<String> = client.option_list_dates(
"EOD", "SPY", "20240419", "500000", "C"
).await?;
// Expiration dates for an underlying
let exps: Vec<String> = client.option_list_expirations("SPY").await?;
// Strike prices for a given expiration
let strikes: Vec<String> = client.option_list_strikes("SPY", "20240419").await?;
// All contracts for a symbol on a date
let contracts: Vec<OptionContract> = tdx.option_list_contracts("EOD", "SPY", "20240315").await?;# All option underlying symbols
symbols = client.option_list_symbols()
# Expiration dates for an underlying
exps = client.option_list_expirations("SPY")
print(exps[:10])
# Strike prices for an expiration
strikes = client.option_list_strikes("SPY", "20240419")
print(f"{len(strikes)} strikes")
# Available dates for a contract
dates = client.option_list_dates("EOD", "SPY", "20240419", "500000", "C")
# All contracts for a symbol on a date
contracts = client.option_list_contracts("EOD", "SPY", "20240315")symbols, _ := client.OptionListSymbols()
exps, _ := client.OptionListExpirations("SPY")
strikes, _ := client.OptionListStrikes("SPY", "20240419")
dates, _ := client.OptionListDates("EOD", "SPY", "20240419", "500000", "C")
contracts, _ := client.OptionListContracts("EOD", "SPY", "20240315")auto symbols = client.option_list_symbols();
auto exps = client.option_list_expirations("SPY");
auto strikes = client.option_list_strikes("SPY", "20240419");
auto dates = client.option_list_dates("EOD", "SPY", "20240419", "500000", "C");
auto contracts = client.option_list_contracts("EOD", "SPY", "20240315");Snapshots
let ohlc = client.option_snapshot_ohlc("SPY", "20240419", "500000", "C").await?;
let trades = client.option_snapshot_trade("SPY", "20240419", "500000", "C").await?;
let quotes = client.option_snapshot_quote("SPY", "20240419", "500000", "C").await?;
let oi = client.option_snapshot_open_interest("SPY", "20240419", "500000", "C").await?;
let mv = client.option_snapshot_market_value("SPY", "20240419", "500000", "C").await?;ohlc = client.option_snapshot_ohlc("SPY", "20240419", "500000", "C")
trades = client.option_snapshot_trade("SPY", "20240419", "500000", "C")
quotes = client.option_snapshot_quote("SPY", "20240419", "500000", "C")
oi = client.option_snapshot_open_interest("SPY", "20240419", "500000", "C")
mv = client.option_snapshot_market_value("SPY", "20240419", "500000", "C")ohlc, _ := client.OptionSnapshotOHLC("SPY", "20240419", "500000", "C")
trades, _ := client.OptionSnapshotTrade("SPY", "20240419", "500000", "C")
quotes, _ := client.OptionSnapshotQuote("SPY", "20240419", "500000", "C")
oi, _ := client.OptionSnapshotOpenInterest("SPY", "20240419", "500000", "C")
mv, _ := client.OptionSnapshotMarketValue("SPY", "20240419", "500000", "C")auto ohlc = client.option_snapshot_ohlc("SPY", "20240419", "500000", "C");
auto trades = client.option_snapshot_trade("SPY", "20240419", "500000", "C");
auto quotes = client.option_snapshot_quote("SPY", "20240419", "500000", "C");
auto oi = client.option_snapshot_open_interest("SPY", "20240419", "500000", "C");
auto mv = client.option_snapshot_market_value("SPY", "20240419", "500000", "C");Snapshot Greeks
// All Greeks at once
let all = client.option_snapshot_greeks_all("SPY", "20240419", "500000", "C").await?;
// By order
let first = client.option_snapshot_greeks_first_order("SPY", "20240419", "500000", "C").await?;
let second = client.option_snapshot_greeks_second_order("SPY", "20240419", "500000", "C").await?;
let third = client.option_snapshot_greeks_third_order("SPY", "20240419", "500000", "C").await?;
// Just IV
let iv = client.option_snapshot_greeks_implied_volatility("SPY", "20240419", "500000", "C").await?;# All Greeks at once
all_g = client.option_snapshot_greeks_all("SPY", "20240419", "500000", "C")
# By order
first = client.option_snapshot_greeks_first_order("SPY", "20240419", "500000", "C")
second = client.option_snapshot_greeks_second_order("SPY", "20240419", "500000", "C")
third = client.option_snapshot_greeks_third_order("SPY", "20240419", "500000", "C")
# Just IV
iv = client.option_snapshot_greeks_implied_volatility("SPY", "20240419", "500000", "C")all, _ := client.OptionSnapshotGreeksAll("SPY", "20240419", "500000", "C")
first, _ := client.OptionSnapshotGreeksFirstOrder("SPY", "20240419", "500000", "C")
second, _ := client.OptionSnapshotGreeksSecondOrder("SPY", "20240419", "500000", "C")
third, _ := client.OptionSnapshotGreeksThirdOrder("SPY", "20240419", "500000", "C")
iv, _ := client.OptionSnapshotGreeksIV("SPY", "20240419", "500000", "C")auto all = client.option_snapshot_greeks_all("SPY", "20240419", "500000", "C");
auto first = client.option_snapshot_greeks_first_order("SPY", "20240419", "500000", "C");
auto second = client.option_snapshot_greeks_second_order("SPY", "20240419", "500000", "C");
auto third = client.option_snapshot_greeks_third_order("SPY", "20240419", "500000", "C");
auto iv = client.option_snapshot_greeks_implied_volatility("SPY", "20240419", "500000", "C");History
// End-of-day option data
let eod: Vec<EodTick> = client.option_history_eod(
"SPY", "20240419", "500000", "C", "20240101", "20240301"
).await?;
// Intraday OHLC bars
let bars: Vec<OhlcTick> = client.option_history_ohlc(
"SPY", "20240419", "500000", "C", "20240315", "60000"
).await?;
// All trades for a date
let trades: Vec<TradeTick> = client.option_history_trade(
"SPY", "20240419", "500000", "C", "20240315"
).await?;
// NBBO quotes at a given interval
let quotes: Vec<QuoteTick> = client.option_history_quote(
"SPY", "20240419", "500000", "C", "20240315", "60000"
).await?;
// Combined trade + quote ticks
let table = client.option_history_trade_quote(
"SPY", "20240419", "500000", "C", "20240315"
).await?;
// Open interest history
let table = client.option_history_open_interest(
"SPY", "20240419", "500000", "C", "20240315"
).await?;# End-of-day option data
eod = client.option_history_eod("SPY", "20240419", "500000", "C",
"20240101", "20240301")
# Intraday OHLC bars
bars = client.option_history_ohlc("SPY", "20240419", "500000", "C",
"20240315", "60000")
# All trades
trades = client.option_history_trade("SPY", "20240419", "500000", "C", "20240315")
# NBBO quotes
quotes = client.option_history_quote("SPY", "20240419", "500000", "C",
"20240315", "60000")
# Combined trade + quote ticks
result = client.option_history_trade_quote("SPY", "20240419", "500000", "C", "20240315")
# Open interest history
oi = client.option_history_open_interest("SPY", "20240419", "500000", "C", "20240315")eod, _ := client.OptionHistoryEOD("SPY", "20240419", "500000", "C", "20240101", "20240301")
bars, _ := client.OptionHistoryOHLC("SPY", "20240419", "500000", "C", "20240315", "60000")
trades, _ := client.OptionHistoryTrade("SPY", "20240419", "500000", "C", "20240315")
quotes, _ := client.OptionHistoryQuote("SPY", "20240419", "500000", "C", "20240315", "60000")
tq, _ := client.OptionHistoryTradeQuote("SPY", "20240419", "500000", "C", "20240315")
oi, _ := client.OptionHistoryOpenInterest("SPY", "20240419", "500000", "C", "20240315")auto eod = client.option_history_eod("SPY", "20240419", "500000", "C", "20240101", "20240301");
auto bars = client.option_history_ohlc("SPY", "20240419", "500000", "C", "20240315", "60000");
auto trades = client.option_history_trade("SPY", "20240419", "500000", "C", "20240315");
auto quotes = client.option_history_quote("SPY", "20240419", "500000", "C", "20240315", "60000");
auto tq = client.option_history_trade_quote("SPY", "20240419", "500000", "C", "20240315");
auto oi = client.option_history_open_interest("SPY", "20240419", "500000", "C", "20240315");History Greeks
// EOD Greeks over a date range
let table = client.option_history_greeks_eod(
"SPY", "20240419", "500000", "C", "20240101", "20240301"
).await?;
// Intraday Greeks sampled by interval
let all = client.option_history_greeks_all(
"SPY", "20240419", "500000", "C", "20240315", "60000"
).await?;
let first = client.option_history_greeks_first_order(
"SPY", "20240419", "500000", "C", "20240315", "60000"
).await?;
let second = client.option_history_greeks_second_order(
"SPY", "20240419", "500000", "C", "20240315", "60000"
).await?;
let third = client.option_history_greeks_third_order(
"SPY", "20240419", "500000", "C", "20240315", "60000"
).await?;
let iv = client.option_history_greeks_implied_volatility(
"SPY", "20240419", "500000", "C", "20240315", "60000"
).await?;# EOD Greeks over a date range
greeks_eod = client.option_history_greeks_eod("SPY", "20240419", "500000", "C",
"20240101", "20240301")
# Intraday Greeks sampled by interval
all_g = client.option_history_greeks_all("SPY", "20240419", "500000", "C",
"20240315", "60000")
first = client.option_history_greeks_first_order("SPY", "20240419", "500000", "C",
"20240315", "60000")
second = client.option_history_greeks_second_order("SPY", "20240419", "500000", "C",
"20240315", "60000")
third = client.option_history_greeks_third_order("SPY", "20240419", "500000", "C",
"20240315", "60000")
iv_hist = client.option_history_greeks_implied_volatility("SPY", "20240419", "500000", "C",
"20240315", "60000")greeksEOD, _ := client.OptionHistoryGreeksEOD("SPY", "20240419", "500000", "C", "20240101", "20240301")
greeksAll, _ := client.OptionHistoryGreeksAll("SPY", "20240419", "500000", "C", "20240315", "60000")
greeksFirst, _ := client.OptionHistoryGreeksFirstOrder("SPY", "20240419", "500000", "C", "20240315", "60000")
greeksIV, _ := client.OptionHistoryGreeksIV("SPY", "20240419", "500000", "C", "20240315", "60000")auto greeks_eod = client.option_history_greeks_eod("SPY", "20240419", "500000", "C",
"20240101", "20240301");
auto greeks_all = client.option_history_greeks_all("SPY", "20240419", "500000", "C",
"20240315", "60000");
auto greeks_iv = client.option_history_greeks_implied_volatility("SPY", "20240419", "500000", "C",
"20240315", "60000");Trade Greeks
Greeks computed on each individual trade:
let all = client.option_history_trade_greeks_all(
"SPY", "20240419", "500000", "C", "20240315"
).await?;
let first = client.option_history_trade_greeks_first_order(
"SPY", "20240419", "500000", "C", "20240315"
).await?;
let second = client.option_history_trade_greeks_second_order(
"SPY", "20240419", "500000", "C", "20240315"
).await?;
let third = client.option_history_trade_greeks_third_order(
"SPY", "20240419", "500000", "C", "20240315"
).await?;
let iv = client.option_history_trade_greeks_implied_volatility(
"SPY", "20240419", "500000", "C", "20240315"
).await?;all_tg = client.option_history_trade_greeks_all("SPY", "20240419", "500000", "C", "20240315")
first_tg = client.option_history_trade_greeks_first_order("SPY", "20240419", "500000", "C", "20240315")
second_tg = client.option_history_trade_greeks_second_order("SPY", "20240419", "500000", "C", "20240315")
third_tg = client.option_history_trade_greeks_third_order("SPY", "20240419", "500000", "C", "20240315")
iv_tg = client.option_history_trade_greeks_implied_volatility("SPY", "20240419", "500000", "C", "20240315")tgAll, _ := client.OptionHistoryTradeGreeksAll("SPY", "20240419", "500000", "C", "20240315")
tgFirst, _ := client.OptionHistoryTradeGreeksFirstOrder("SPY", "20240419", "500000", "C", "20240315")
tgIV, _ := client.OptionHistoryTradeGreeksIV("SPY", "20240419", "500000", "C", "20240315")auto tg_all = client.option_history_trade_greeks_all("SPY", "20240419", "500000", "C", "20240315");
auto tg_first = client.option_history_trade_greeks_first_order("SPY", "20240419", "500000", "C",
"20240315");
auto tg_iv = client.option_history_trade_greeks_implied_volatility("SPY", "20240419", "500000", "C",
"20240315");At-Time
let trades: Vec<TradeTick> = client.option_at_time_trade(
"SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000" // 9:30 AM ET
).await?;
let quotes: Vec<QuoteTick> = client.option_at_time_quote(
"SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000"
).await?;trades = client.option_at_time_trade("SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000")
quotes = client.option_at_time_quote("SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000")trades, _ := client.OptionAtTimeTrade("SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000")
quotes, _ := client.OptionAtTimeQuote("SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000")auto trades = client.option_at_time_trade("SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000");
auto quotes = client.option_at_time_quote("SPY", "20240419", "500000", "C",
"20240101", "20240301", "34200000");Streaming Large Option Responses (Rust)
client.option_history_trade_stream(
"SPY", "20240419", "500000", "C", "20240315",
|chunk| { Ok(()) }
).await?;
client.option_history_quote_stream(
"SPY", "20240419", "500000", "C", "20240315", "0",
|chunk| { Ok(()) }
).await?;Index Endpoints (9)
List
let symbols: Vec<String> = client.index_list_symbols().await?;
let dates: Vec<String> = client.index_list_dates("SPX").await?;symbols = client.index_list_symbols()
dates = client.index_list_dates("SPX")symbols, _ := client.IndexListSymbols()
dates, _ := client.IndexListDates("SPX")auto symbols = client.index_list_symbols();
auto dates = client.index_list_dates("SPX");Snapshots
let ohlc: Vec<OhlcTick> = client.index_snapshot_ohlc(&["SPX", "NDX"]).await?;
let ticks: Vec<PriceTick> = tdx.index_snapshot_price(&["SPX", "NDX"]).await?;
let ticks: Vec<MarketValueTick> = tdx.index_snapshot_market_value(&["SPX"]).await?;ohlc = client.index_snapshot_ohlc(["SPX", "NDX"])
price = client.index_snapshot_price(["SPX", "NDX"])
mv = client.index_snapshot_market_value(["SPX"])ohlc, _ := client.IndexSnapshotOHLC([]string{"SPX", "NDX"})
price, _ := client.IndexSnapshotPrice([]string{"SPX"})
mv, _ := client.IndexSnapshotMarketValue([]string{"SPX"})auto ohlc = client.index_snapshot_ohlc({"SPX", "NDX"});
auto price = client.index_snapshot_price({"SPX"});
auto mv = client.index_snapshot_market_value({"SPX"});History
let eod: Vec<EodTick> = client.index_history_eod("SPX", "20240101", "20240301").await?;
let bars: Vec<OhlcTick> = client.index_history_ohlc(
"SPX", "20240101", "20240301", "60000"
).await?;
let ticks: Vec<PriceTick> = tdx.index_history_price("SPX", "20240315", "60000").await?;eod = client.index_history_eod("SPX", "20240101", "20240301")
df = client.index_history_eod_df("SPX", "20240101", "20240301")
bars = client.index_history_ohlc("SPX", "20240101", "20240301", "60000")
price = client.index_history_price("SPX", "20240315", "60000")eod, _ := client.IndexHistoryEOD("SPX", "20240101", "20240301")
bars, _ := client.IndexHistoryOHLC("SPX", "20240101", "20240301", "60000")
priceHist, _ := client.IndexHistoryPrice("SPX", "20240315", "60000")auto eod = client.index_history_eod("SPX", "20240101", "20240301");
auto bars = client.index_history_ohlc("SPX", "20240101", "20240301", "60000");
auto price_hist = client.index_history_price("SPX", "20240315", "60000");At-Time
let ticks: Vec<PriceTick> = tdx.index_at_time_price(
"SPX", "20240101", "20240301", "34200000"
).await?;result = client.index_at_time_price("SPX", "20240101", "20240301", "34200000")atTime, _ := client.IndexAtTimePrice("SPX", "20240101", "20240301", "34200000")auto at_time = client.index_at_time_price("SPX", "20240101", "20240301", "34200000");Rate Endpoints (1)
let rates: Vec<InterestRateTick> = tdx.interest_rate_history_eod(
"SOFR", "20240101", "20240301"
).await?;result = client.interest_rate_history_eod("SOFR", "20240101", "20240301")result, _ := client.InterestRateHistoryEOD("SOFR", "20240101", "20240301")auto result = client.interest_rate_history_eod("SOFR", "20240101", "20240301");Available rate symbols: SOFR, TREASURY_M1, TREASURY_M3, TREASURY_M6, TREASURY_Y1, TREASURY_Y2, TREASURY_Y3, TREASURY_Y5, TREASURY_Y7, TREASURY_Y10, TREASURY_Y20, TREASURY_Y30.
Calendar Endpoints (3)
let days: Vec<CalendarDay> = tdx.calendar_open_today().await?;
let days: Vec<CalendarDay> = tdx.calendar_on_date("20240315").await?;
let days: Vec<CalendarDay> = tdx.calendar_year("2024").await?;result = client.calendar_open_today()
result = client.calendar_on_date("20240315")
result = client.calendar_year("2024")result, _ := client.CalendarOpenToday()
result, _ = client.CalendarOnDate("20240315")
result, _ = client.CalendarYear("2024")auto today = client.calendar_open_today();
auto date_info = client.calendar_on_date("20240315");
auto year_info = client.calendar_year("2024");Time Reference
| Time (ET) | Milliseconds |
|---|---|
| 9:30 AM | 34200000 |
| 12:00 PM | 43200000 |
| 4:00 PM | 57600000 |
Empty Responses
When a query returns no data (e.g., a non-trading date), the SDK returns an empty collection rather than an error. Check for emptiness using the appropriate idiom for your language:
if eod.is_empty() {
println!("No data for this date range");
}if not eod:
print("No data for this date range")if len(eod) == 0 {
fmt.Println("No data for this date range")
}if (eod.empty()) {
std::cout << "No data for this date range" << std::endl;
}