Skip to content

Trade Quote

FreeValueStandardPro

Fetch combined trade + quote ticks for a stock on a given date. Returns raw DataTable.

Returns every trade reported by UTP & CTA paired with the last BBO quote reported by UTP or CTA at the time of trade. A quote is matched with a trade if its timestamp <= the trade timestamp. If you prefer to match quotes with timestamps that are < the trade timestamp, specify the exclusive parameter to true. Set the venue parameter to nqb to access current-day real-time historic data from the Nasdaq Basic feed if the account has a stocks standard or pro subscription.

  • Multi-day requests are limited to 1 month of data.
AAPL
Client
Auth
Style
from thetadatadx import Client

client = Client.from_env()

rows = client.market_data.stock_history_trade_quote(
    "AAPL",
)
for t in rows:
    print(t.ms_of_day, t.price, t.bid, t.ask)
Sample response · JSON
[
  {
    "ask": 130.4,
    "ask_condition": 0,
    "ask_exchange": 7,
    "ask_size": 1,
    "bid": 130.26,
    "bid_condition": 0,
    "bid_exchange": 7,
    "bid_size": 4,
    "condition": 115,
    "exchange": 60,
    "ext_condition1": 32,
    "ext_condition2": 255,
    "ext_condition3": 255,
    "ext_condition4": 115,
    "price": 130.33,
    "quote_timestamp": "2023-01-03T09:30:00.001",
    "sequence": 562,
    "size": 1,
    "trade_timestamp": "2023-01-03T09:30:00.002"
  },
  {
    "ask": 130.4,
    "ask_condition": 0,
    "ask_exchange": 7,
    "ask_size": 1,
    "bid": 130.26,
    "bid_condition": 0,
    "bid_exchange": 7,
    "bid_size": 4,
    "condition": 115,
    "exchange": 60,
    "ext_condition1": 32,
    "ext_condition2": 255,
    "ext_condition3": 255,
    "ext_condition4": 115,
    "price": 130.33,
    "quote_timestamp": "2023-01-03T09:30:00.002",
    "sequence": 563,
    "size": 24,
    "trade_timestamp": "2023-01-03T09:30:00.003"
  },
  {
    "ask": 130.4,
    "ask_condition": 0,
    "ask_exchange": 7,
    "ask_size": 1,
    "bid": 130.26,
    "bid_condition": 0,
    "bid_exchange": 7,
    "bid_size": 4,
    "condition": 115,
    "exchange": 60,
    "ext_condition1": 32,
    "ext_condition2": 255,
    "ext_condition3": 255,
    "ext_condition4": 115,
    "price": 130.33,
    "quote_timestamp": "2023-01-03T09:30:00.002",
    "sequence": 564,
    "size": 40,
    "trade_timestamp": "2023-01-03T09:30:00.003"
  }
]

Parameters

NameTypeRequiredDefaultDescription
symbolstringyesTicker symbol (e.g. AAPL)
datedatenoSingle date YYYYMMDD. Supply this for a single-day pull, or supply start_date/end_date for a range. When present, date takes precedence over the range.
start_timestringno09:30:00Start time filter
end_timestringno16:00:00End time filter
exclusiveboolnofalseWhen true, quotes whose timestamp equals the trade timestamp are excluded; only quotes strictly before the trade are paired.
venuestringnonqbVenue/exchange filter. Accepted values: nqb, utp_cta.
start_datedatenoStart date YYYYMMDD
end_datedatenoEnd date YYYYMMDD
timeout_msintnoPer-request deadline in milliseconds. 0 means no deadline.

Response

Rows of TradeQuoteTick:

FieldTypeDescription
ms_of_dayi32Milliseconds since midnight Eastern Time.
sequencei32Exchange-assigned trade sequence number.
ext_condition1i32Additional trade condition code.
ext_condition2i32Additional trade condition code.
ext_condition3i32Additional trade condition code.
ext_condition4i32Additional trade condition code.
conditioni32Trade condition code.
sizei32Number of contracts or shares traded.
exchangei32Exchange code where the trade executed.
pricef64Trade price.
condition_flagsi32Trade condition flags bitmap.
price_flagsi32Trade price flags bitmap.
volume_typei32Volume reporting mode: 0 = incremental, 1 = cumulative.
records_backi32Offset of this record behind the most recent record.
quote_ms_of_dayi32Timestamp of the paired quote, milliseconds since midnight ET.
bid_sizei32Last NBBO bid size.
bid_exchangei32Exchange code of the NBBO bid.
bidf64NBBO bid at the time of the trade.
bid_conditioni32Quote condition code on the bid side.
ask_sizei32Last NBBO ask size.
ask_exchangei32Exchange code of the NBBO ask.
askf64NBBO ask at the time of the trade.
ask_conditioni32Quote condition code on the ask side.
datei32Trading date as a YYYYMMDD integer.

Released under the Apache-2.0 License.