stock_history_trade
Retrieve every trade execution for a stock on a given date. Returns tick-level data with price, size, exchange, and condition codes.
FreeValueStandardPro
Code Example
rust
let data = tdx.stock_history_trade("SPY", "20260315").await?;
for t in &data {
println!("date={} ms_of_day={} price={:.2} size={} exchange={} condition={} sequence={}",
t.date, t.ms_of_day, t.price, t.size, t.exchange, t.condition, t.sequence);
}python
data = tdx.stock_history_trade("SPY", "20260315")
for t in data:
print(f"date={t.date} ms_of_day={t.ms_of_day} price={t.price:.2f} "
f"size={t.size} exchange={t.exchange} condition={t.condition} sequence={t.sequence}")typescript
const data = tdx.stockHistoryTrade('SPY', '20260315');
for (const t of data) {
console.log(`date=${t.date} ms_of_day=${t.ms_of_day} price=${t.price} size=${t.size} exchange=${t.exchange} condition=${t.condition}`);
}cpp
auto data = client.stock_history_trade("SPY", "20260315");
for (const auto& t : data) {
printf("date=%d ms_of_day=%d price=%.2f size=%d exchange=%d condition=%d sequence=%d\n",
t.date, t.ms_of_day, t.price, t.size, t.exchange, t.condition, t.sequence);
}Parameters
symbolstringrequiredTicker symbol
datestringrequiredDate in
YYYYMMDD formatstart_timestringoptionalStart time as milliseconds from midnight ET
end_timestringoptionalEnd time as milliseconds from midnight ET
venuestringoptionalData venue filter
Response Fields (TradeTick)
ms_of_dayi32Milliseconds since midnight ET
sequencei32Sequence number
ext_condition1 through ext_condition4i32Extended trade condition codes
conditioni32Trade condition code (encodes SIP condition flags such as regular sale, odd lot, intermarket sweep)
sizei32Trade size in shares
exchangei32Exchange code
pricef64Trade price (decoded at parse time).
condition_flagsi32Condition flags bitmap
price_flagsi32Price flags bitmap
volume_typei320 = incremental volume, 1 = cumulative volumerecords_backi32Records back count
datei32Date as
YYYYMMDD integerHelper methods: is_cancelled(), regular_trading_hours(), is_seller(), is_incremental_volume()
Sample Response
json
[
{"date": 20260402, "ms_of_day": 34200000, "price": 646.42, "size": 126, "exchange": 4, "condition": 1, "sequence": 1704668},
{"date": 20260402, "ms_of_day": 34200000, "price": 646.42, "size": 126, "exchange": 73, "condition": 95, "sequence": 1704670},
{"date": 20260402, "ms_of_day": 34200000, "price": 646.42, "size": 126, "exchange": 43, "condition": 95, "sequence": 1704674}
]SPY trades on 2026-04-02. Full response contains 887,576 trades. Use the
_streamvariant for large responses.
Notes
- A single day of AAPL trades can exceed 100,000 rows. Use the Rust
_streamvariant for large responses to avoid holding everything in memory. - Use
start_timeandend_timeto limit to regular trading hours (9:30 AM =34200000, 4:00 PM =57600000). - The
conditionandcondition_flagsfields encode SIP trade condition codes (e.g., regular sale, odd lot, intermarket sweep).