Skip to content

stock_at_time_trade

Retrieve the trade at a specific time of day across a date range. Returns one trade per date, representing the trade that occurred at or just before the specified time.

The time_of_day parameter uses ET wall-clock format HH:MM:SS.SSS (for example 09:30:00.000). Legacy millisecond strings such as 34200000 are also accepted.

FreeValueStandardPro

Code Example

rust
let data = tdx.stock_at_time_trade("SPY", "20260101", "20260301", "09:30:00.000").await?;
for t in &data {
    println!("date={} ms_of_day={} price={:.2} size={}",
        t.date, t.ms_of_day, t.price, t.size);
}
python
data = tdx.stock_at_time_trade("SPY", "20260101", "20260301", "09:30:00.000")
for t in data:
    print(f"date={t.date} ms_of_day={t.ms_of_day} price={t.price:.2f} size={t.size}")
typescript
const data = tdx.stockAtTimeTrade('SPY', '20260101', '20260301', '09:30:00.000');
for (const t of data) {
    console.log(`date=${t.date} ms_of_day=${t.ms_of_day} price=${t.price} size=${t.size}`);
}
cpp
auto data = client.stock_at_time_trade("SPY", "20260101", "20260301", "09:30:00.000");
for (const auto& t : data) {
    printf("date=%d ms_of_day=%d price=%.2f size=%d\n", t.date, t.ms_of_day, t.price, t.size);
}

Parameters

symbolstringrequired
Ticker symbol
start_datestringrequired
Start date in YYYYMMDD format
end_datestringrequired
End date in YYYYMMDD format
time_of_daystringrequired
ET wall-clock time in HH:MM:SS.SSS (e.g. "09:30:00.000"; legacy "34200000" is also accepted)
venuestringoptional
Data venue filter

Response Fields (TradeTick)

ms_of_dayi32
Milliseconds since midnight ET
sequencei32
Sequence number
ext_condition1 through ext_condition4i32
Extended trade condition codes
conditioni32
Trade condition code
sizei32
Trade size in shares
exchangei32
Exchange code
pricef64
Trade price (decoded at parse time).
condition_flagsi32
Condition flags bitmap
price_flagsi32
Price flags bitmap
volume_typei32
0 = incremental volume, 1 = cumulative volume
records_backi32
Records back count
datei32
Date as YYYYMMDD integer

Helper methods: is_cancelled(), regular_trading_hours(), is_seller(), is_incremental_volume()

Common Time Values

Time (ET)time_of_day
9:30 AM (market open)"09:30:00.000"
10:00 AM"10:00:00.000"
12:00 PM (noon)"12:00:00.000"
3:00 PM"15:00:00.000"
4:00 PM (market close)"16:00:00.000"

Sample Response

json
[
  {"date": 20260330, "ms_of_day": 43199998, "price": 637.34, "size": 2140},
  {"date": 20260331, "ms_of_day": 43199983, "price": 639.79, "size": 100},
  {"date": 20260401, "ms_of_day": 43199879, "price": 657.82, "size": 100}
]

SPY trade closest to 12:00 PM ET on each date. One row per date in the range.

Notes

  • Returns one TradeTick per trading day in the date range.
  • Useful for building daily time series at a consistent intraday timestamp (e.g., "price at 10:00 AM every day").
  • The returned trade is the one that occurred at or just before the specified time.

Released under the Apache-2.0 License.