Skip to content

Trade

FreeValueStandardPro

Fetch all trades for a stock on a given date.

Returns every trade reported by UTP & CTA. 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(
    "AAPL",
)
for t in rows:
    print(t.date, t.ms_of_day, t.price, t.size)
Sample response · JSON
[
  {
    "condition": 1,
    "exchange": 7,
    "ext_condition1": 32,
    "ext_condition2": 95,
    "ext_condition3": 1,
    "ext_condition4": 115,
    "price": 187.18,
    "sequence": 14920,
    "size": 2,
    "timestamp": "2024-01-02T09:30:00.011"
  },
  {
    "condition": 1,
    "exchange": 1,
    "ext_condition1": 32,
    "ext_condition2": 255,
    "ext_condition3": 1,
    "ext_condition4": 115,
    "price": 187.18,
    "sequence": 8931,
    "size": 1,
    "timestamp": "2024-01-02T09:30:00.014"
  },
  {
    "condition": 1,
    "exchange": 1,
    "ext_condition1": 32,
    "ext_condition2": 255,
    "ext_condition3": 1,
    "ext_condition4": 115,
    "price": 187.18,
    "sequence": 8932,
    "size": 5,
    "timestamp": "2024-01-02T09:30:00.014"
  }
]

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
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 TradeTick:

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.
datei32Trading date as a YYYYMMDD integer.

Released under the Apache-2.0 License.