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 is milliseconds from midnight ET (e.g., 34200000 = 9:30 AM).

FreeValueStandardPro

Code Example

rust
// Trade at 9:30 AM across Q1 2024
let trades: Vec<TradeTick> = tdx.stock_at_time_trade(
    "AAPL", "20240101", "20240301", "34200000"
).await?;
for t in &trades {
    println!("{}: price={}", t.date, t.get_price());
}
python
# Trade at 9:30 AM across Q1 2024
trades = tdx.stock_at_time_trade("AAPL", "20240101", "20240301", "34200000")
for t in trades:
    print(f"{t['date']}: price={t['price']:.2f}")
go
// Trade at 9:30 AM across Q1 2024
trades, err := client.StockAtTimeTrade("AAPL", "20240101", "20240301", "34200000")
if err != nil {
    log.Fatal(err)
}
for _, t := range trades {
    fmt.Printf("%d: price=%.2f\n", t.Date, t.Price)
}
cpp
// Trade at 9:30 AM across Q1 2024
auto trades = client.stock_at_time_trade("AAPL", "20240101", "20240301", "34200000");
for (auto& t : trades) {
    std::cout << t.date << ": price=" << t.price << std::endl;
}

Parameters

symbolstringrequired
Ticker symbol
start_datestringrequired
Start date in YYYYMMDD format
end_datestringrequired
End date in YYYYMMDD format
time_of_daystringrequired
Milliseconds from midnight ET (e.g. "34200000" = 9:30 AM)
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
pricei32
Fixed-point price. Use get_price() for decoded f64.
condition_flagsi32
Condition flags bitmap
price_flagsi32
Price flags bitmap
volume_typei32
0 = incremental volume, 1 = cumulative volume
records_backi32
Records back count
price_typei32
Decimal type for price decoding
datei32
Date as YYYYMMDD integer

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

Common Time Values

Time (ET)Milliseconds
9:30 AM (market open)"34200000"
10:00 AM"36000000"
12:00 PM (noon)"43200000"
3:00 PM"54000000"
4:00 PM (market close)"57600000"

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 GPL-3.0-or-later License.