Trade Quote
FreeValueStandardPro
Fetch every stock trade of one date, each paired with the NBBO quote at the time of the trade. The vendor keeps the most recent 7 calendar days.
from thetadatadx import Client
client = Client.from_env()
rows = client.market_data.stock_flat_file_trade_quote(
"",
)
for t in rows:
print(t.ms_of_day, t.price, t.bid, t.ask) Sample response ·
JSON[
{
"ask": "130.4000",
"ask_condition": 0,
"ask_exchange": 7,
"ask_size": 1,
"bid": "130.2600",
"bid_condition": 0,
"bid_exchange": 7,
"bid_size": 4,
"condition": 115,
"condition_flags": 0,
"date": 20260803,
"exchange": 60,
"ext_condition1": 32,
"ext_condition2": 255,
"ext_condition3": 255,
"ext_condition4": 115,
"ms_of_day": 34200002,
"ms_of_day2": 34200001,
"price": "130.3300",
"price_flags": 0,
"records_back": 0,
"root": "AAPL",
"sequence": 562,
"size": 1,
"volume_type": 0
},
{
"ask": "130.4000",
"ask_condition": 0,
"ask_exchange": 7,
"ask_size": 1,
"bid": "130.2600",
"bid_condition": 0,
"bid_exchange": 7,
"bid_size": 4,
"condition": 115,
"condition_flags": 0,
"date": 20260803,
"exchange": 60,
"ext_condition1": 32,
"ext_condition2": 255,
"ext_condition3": 255,
"ext_condition4": 115,
"ms_of_day": 34200003,
"ms_of_day2": 34200002,
"price": "130.3300",
"price_flags": 0,
"records_back": 0,
"root": "AAPL",
"sequence": 563,
"size": 24,
"volume_type": 0
}
]Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
date | date | yes | - | Date YYYYMMDD |
timeout_ms | int | no | - | Per-request deadline in milliseconds. 0 means no deadline. |
Response
Rows of TradeQuoteTick:
| Field | Type | Description |
|---|---|---|
ms_of_day | i32 | Milliseconds since midnight Eastern Time. |
sequence | i32 | Exchange-assigned trade sequence number. |
ext_condition1 | i32 | Additional trade condition code. |
ext_condition2 | i32 | Additional trade condition code. |
ext_condition3 | i32 | Additional trade condition code. |
ext_condition4 | i32 | Additional trade condition code. |
condition | i32 | Trade condition code. Zero is a code the vendor assigns a meaning, so read columns() to tell a reported zero from a response that carried no such column. |
size | i32 | Number of contracts or shares traded. |
exchange | i32 | Exchange code where the trade executed. Zero is a code the vendor assigns a meaning, so read columns() to tell a reported zero from a response that carried no such column. |
price | f64 | Trade price. |
condition_flags | i32 | Trade condition flags bitmap. |
price_flags | i32 | Trade price flags bitmap. |
volume_type | i32 | Volume reporting mode, as sent. The vendor does not define this column. |
records_back | i32 | Offset of this record behind the most recent record. |
quote_ms_of_day | i32 | Timestamp of the paired quote, milliseconds since midnight ET. The vendor names this column MS_OF_DAY2. |
bid_size | i32 | Last NBBO bid size. |
bid_exchange | i32 | Exchange code of the NBBO bid. Zero is a code the vendor assigns a meaning, so read columns() to tell a reported zero from a response that carried no such column. |
bid | f64 | NBBO bid at the time of the trade. |
bid_condition | i32 | Quote condition code on the bid side. Zero is a code the vendor assigns a meaning, so read columns() to tell a reported zero from a response that carried no such column. |
ask_size | i32 | Last NBBO ask size. |
ask_exchange | i32 | Exchange code of the NBBO ask. Zero is a code the vendor assigns a meaning, so read columns() to tell a reported zero from a response that carried no such column. |
ask | f64 | NBBO ask at the time of the trade. |
ask_condition | i32 | Quote condition code on the ask side. Zero is a code the vendor assigns a meaning, so read columns() to tell a reported zero from a response that carried no such column. |
date | i32 | Trading date as a YYYYMMDD integer. |