ThetaData History API

The History API from ThetaData — 26 operation(s) for history.

OpenAPI Specification

thetadata-history-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Theta Data v3 At-Time History API
  description: Real-time and historic stock, options, and index data!
  version: 3.0.0
  x-java-package: net.thetadata.generated
servers:
- url: http://127.0.0.1:25503/v3
  description: dev
security: []
tags:
- name: History
paths:
  /stock/history/eod:
    x-concurrent-limit-ttl-ms: '580'
    x-min-subscription: free
    x-history-access: true
    get:
      summary: End of Day
      operationId: stock_history_eod
      x-codeSamples:
      - lang: Python
        label: pandas
        source: "from thetadata import ThetaClient\nfrom datetime import date\n\nclient = ThetaClient(dataframe_type='pandas')\ndf = client.stock_history_eod(\n    symbol='AAPL',\n    start_date=date(2024, 1, 1),\n    end_date=date(2024, 1, 31),\n)\n"
      - lang: Python
        label: polars
        source: "from thetadata import ThetaClient\nfrom datetime import date\n\nclient = ThetaClient(dataframe_type='polars')\ndf = client.stock_history_eod(\n    symbol='AAPL',\n    start_date=date(2024, 1, 1),\n    end_date=date(2024, 1, 31),\n)\n"
      tags:
      - History
      description: '

        Since [the equity SIPs](/Articles/Data-And-Requests/The-SIPs.html) only generate a partial EOD report, Theta Data generates a national EOD report at 17:15 ET each day. ``created`` represents the datetime the report was generated and ``last_trade`` represents the datetime of the last trade. The quote in the response represents the last NBBO reported by [CTA or UTP](/Articles/Data-And-Requests/The-SIPs.html) at the time of report generation. You can read more about EOD & OHLC data [here](/Articles/Data-And-Requests/OHLC-EOD.html). Theta Data plans to avail SIP EOD reports in the near future.

        '
      x-sample-urls:
      - url: http://127.0.0.1:25503/v3/stock/history/eod?symbol=AAPL&start_date=20240101&end_date=20240131
        description: Returns EOD report for a given symbol between specified dates (inclusive)
      - url: http://127.0.0.1:25503/v3/stock/history/eod?symbol=AAPL&start_date=20240101&end_date=20240131&format=html
        description: Click to open in browser (HTML)
      parameters:
      - $ref: '#/components/parameters/single_symbol'
      - $ref: '#/components/parameters/start_date'
      - $ref: '#/components/parameters/end_date'
      - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Returns EOD report for a given symbol between specified dates (inclusive)
          content:
            text/csv:
              schema:
                type: array
                items: &id001
                  type: object
                  properties:
                    created:
                      type: string
                      format: date-time
                      description: The date formated as YYYY-MM-DDTHH:mm:ss.SSS format.
                    last_trade:
                      type: string
                      format: date-time
                      description: The last trade date formated as YYYY-MM-DDTHH:mm:ss.SSS format.
                    open:
                      type: number
                      description: The opening trade price.
                    high:
                      type: number
                      description: The highest traded price.
                    low:
                      type: number
                      description: The lowest traded price.
                    close:
                      type: number
                      description: The closing traded price.
                    volume:
                      type: integer
                      description: The amount of contracts / shares traded.
                    count:
                      type: integer
                      description: The amount of trades.
                    bid_size:
                      type: integer
                      description: The last NBBO bid size.
                    bid_exchange:
                      type: integer
                      description: The last NBBO bid [exchange](/Articles/Errors-Exchanges-Conditions/Exchanges.html).
                    bid:
                      type: number
                      description: The last NBBO bid price.
                    bid_condition:
                      type: integer
                      description: The last NBBO bid [condition](/Articles/Errors-Exchanges-Conditions/Quote-Conditions.html).
                    ask_size:
                      type: integer
                      description: The last NBBO ask size.
                    ask_exchange:
                      type: integer
                      description: The last NBBO ask [exchange](/Articles/Errors-Exchanges-Conditions/Exchanges.html).
                    ask:
                      type: number
                      description: The last NBBO ask price.
                    ask_condition:
                      type: integer
                      description: The last NBBO ask [condition](/Articles/Errors-Exchanges-Conditions/Quote-Conditions.html).
              example: "created,last_trade,open,high,low,close,volume,count,bid_size,bid_exchange,bid,bid_condition,ask_size,ask_exchange,ask,ask_condition\r\n2024-01-02T17:17:53.606,2024-01-02T17:17:51.877,187.030,188.440,183.885,185.640,80680243,1003582,2,7,18.534,0,2,1,18.536,0\r\n2024-01-03T17:16:29.883,2024-01-03T17:16:28.586,184.200,185.880,183.430,184.250,58308345,654127,5,7,18.405,0,2,1,18.410,0\r\n2024-01-04T17:17:06.02,2024-01-04T17:17:02.445,182.0000,183.0872,180.8800,181.9100,71197269,709246,8,60,1.8176,0,2,7,1.8179,0\r\n2024-01-05T17:16:57.032,2024-01-05T17:16:49.821,181.900,182.760,180.170,181.180,61949135,679405,3,1,18.103,0,3,7,18.105,0\r\n2024-01-08T17:17:01.83,2024-01-08T17:17:01.484,182.000,185.600,181.500,185.560,59029146,665626,4,1,18.528,0,1,65,18.537,0\r\n"
            application/json:
              schema: &id002
                type: array
                items: *id001
              example: "{\n  \"response\": [\n    {\"ask_size\":2,\"last_trade\":\"2024-01-02T17:17:51.877\",\"created\":\"2024-01-02T17:17:53.606\",\"ask_condition\":0,\"count\":1003582,\"volume\":80680243,\"high\":188.440,\"low\":183.885,\"bid_size\":2,\"ask_exchange\":1,\"bid_exchange\":7,\"ask\":18.536,\"bid\":18.534,\"bid_condition\":0,\"close\":185.640,\"open\":187.030},\n    {\"ask_size\":2,\"last_trade\":\"2024-01-03T17:16:28.586\",\"created\":\"2024-01-03T17:16:29.883\",\"ask_condition\":0,\"count\":654127,\"volume\":58308345,\"high\":185.880,\"low\":183.430,\"bid_size\":5,\"ask_exchange\":1,\"bid_exchange\":7,\"ask\":18.410,\"bid\":18.405,\"bid_condition\":0,\"close\":184.250,\"open\":184.200},\n    {\"ask_size\":2,\"last_trade\":\"2024-01-04T17:17:02.445\",\"created\":\"2024-01-04T17:17:06.02\",\"ask_condition\":0,\"count\":709246,\"volume\":71197269,\"high\":183.0872,\"low\":180.8800,\"bid_size\":8,\"ask_exchange\":7,\"bid_exchange\":60,\"ask\":1.8179,\"bid\":1.8176,\"bid_condition\":0,\"close\":181.9100,\"open\":182.0000},\n    {\"ask_size\":3,\"last_trade\":\"2024-01-05T17:16:49.821\",\"created\":\"2024-01-05T17:16:57.032\",\"ask_condition\":0,\"count\":679405,\"volume\":61949135,\"high\":182.760,\"low\":180.170,\"bid_size\":3,\"ask_exchange\":7,\"bid_exchange\":1,\"ask\":18.105,\"bid\":18.103,\"bid_condition\":0,\"close\":181.180,\"open\":181.900},\n    {\"ask_size\":1,\"last_trade\":\"2024-01-08T17:17:01.484\",\"created\":\"2024-01-08T17:17:01.83\",\"ask_condition\":0,\"count\":665626,\"volume\":59029146,\"high\":185.600,\"low\":181.500,\"bid_size\":4,\"ask_exchange\":65,\"bid_exchange\":1,\"ask\":18.537,\"bid\":18.528,\"bid_condition\":0,\"close\":185.560,\"open\":182.000}\n  ]\n}\n"
            application/x-ndjson:
              schema: *id002
              example: '{"ask_size":2,"last_trade":"2024-01-02T17:17:51.877","created":"2024-01-02T17:17:53.606","ask_condition":0,"count":1003582,"volume":80680243,"high":188.440,"low":183.885,"bid_size":2,"ask_exchange":1,"bid_exchange":7,"ask":18.536,"bid":18.534,"bid_condition":0,"close":185.640,"open":187.030}

                {"ask_size":2,"last_trade":"2024-01-03T17:16:28.586","created":"2024-01-03T17:16:29.883","ask_condition":0,"count":654127,"volume":58308345,"high":185.880,"low":183.430,"bid_size":5,"ask_exchange":1,"bid_exchange":7,"ask":18.410,"bid":18.405,"bid_condition":0,"close":184.250,"open":184.200}

                {"ask_size":2,"last_trade":"2024-01-04T17:17:02.445","created":"2024-01-04T17:17:06.02","ask_condition":0,"count":709246,"volume":71197269,"high":183.0872,"low":180.8800,"bid_size":8,"ask_exchange":7,"bid_exchange":60,"ask":1.8179,"bid":1.8176,"bid_condition":0,"close":181.9100,"open":182.0000}

                {"ask_size":3,"last_trade":"2024-01-05T17:16:49.821","created":"2024-01-05T17:16:57.032","ask_condition":0,"count":679405,"volume":61949135,"high":182.760,"low":180.170,"bid_size":3,"ask_exchange":7,"bid_exchange":1,"ask":18.105,"bid":18.103,"bid_condition":0,"close":181.180,"open":181.900}

                {"ask_size":1,"last_trade":"2024-01-08T17:17:01.484","created":"2024-01-08T17:17:01.83","ask_condition":0,"count":665626,"volume":59029146,"high":185.600,"low":181.500,"bid_size":4,"ask_exchange":65,"bid_exchange":1,"ask":18.537,"bid":18.528,"bid_condition":0,"close":185.560,"open":182.000}'
            python/pandas:
              schema: *id002
              example: 'created                       last_trade    open    high     low   close    volume   count  bid_size  bid_exchange     bid  bid_condition  ask_size  ask_exchange     ask  ask_condition

                0 2025-10-02 17:15:40.365000-04:00 2025-10-02 17:15:30.829000-04:00  256.60  258.18  254.15  257.13  42543552  483678         1            60  257.40              0        19             7  257.50              0

                1 2025-10-03 17:15:50.597000-04:00 2025-10-03 17:15:27.845000-04:00  254.64  259.24  253.95  258.02  49090168  704668         2             7  257.81              0         3             1  257.98              0

                '
            python/polars:
              schema: *id002
              example: 'shape: (2, 16)

                ┌────────────────────────────────┬────────────────────────────────┬────────┬────────┬────────┬────────┬──────────┬────────┬──────────┬──────────────┬────────┬───────────────┬──────────┬──────────────┬────────┬───────────────┐

                │ created                        ┆ last_trade                     ┆ open   ┆ high   ┆ low    ┆ close  ┆ volume   ┆ count  ┆ bid_size ┆ bid_exchange ┆ bid    ┆ bid_condition ┆ ask_size ┆ ask_exchange ┆ ask    ┆ ask_condition │

                │ ---                            ┆ ---                            ┆ ---    ┆ ---    ┆ ---    ┆ ---    ┆ ---      ┆ ---    ┆ ---      ┆ ---          ┆ ---    ┆ ---           ┆ ---      ┆ ---          ┆ ---    ┆ ---           │

                │ datetime[ms, America/New_York] ┆ datetime[ms, America/New_York] ┆ f64    ┆ f64    ┆ f64    ┆ f64    ┆ i64      ┆ i64    ┆ i64      ┆ i64          ┆ f64    ┆ i64           ┆ i64      ┆ i64          ┆ f64    ┆ i64           │

                ╞════════════════════════════════╪════════════════════════════════╪════════╪════════╪════════╪════════╪══════════╪════════╪══════════╪══════════════╪════════╪═══════════════╪══════════╪══════════════╪════════╪═══════════════╡

                │ 2025-10-02 17:15:40.365 EDT    ┆ 2025-10-02 17:15:30.829 EDT    ┆ 256.6  ┆ 258.18 ┆ 254.15 ┆ 257.13 ┆ 42543552 ┆ 483678 ┆ 1        ┆ 60           ┆ 257.4  ┆ 0             ┆ 19       ┆ 7            ┆ 257.5  ┆ 0             │

                │ 2025-10-03 17:15:50.597 EDT    ┆ 2025-10-03 17:15:27.845 EDT    ┆ 254.64 ┆ 259.24 ┆ 253.95 ┆ 258.02 ┆ 49090168 ┆ 704668 ┆ 2        ┆ 7            ┆ 257.81 ┆ 0             ┆ 3        ┆ 1            ┆ 257.98 ┆ 0             │

                └────────────────────────────────┴────────────────────────────────┴────────┴────────┴────────┴────────┴──────────┴────────┴──────────┴──────────────┴────────┴───────────────┴──────────┴──────────────┴────────┴───────────────┘

                '
  /stock/history/ohlc:
    x-concurrent-limit-ttl-ms: '695'
    x-min-subscription: value
    x-history-access: true
    get:
      summary: Open High Low Close
      operationId: stock_history_ohlc
      x-codeSamples:
      - lang: Python
        label: pandas
        source: 'from thetadata import ThetaClient


          client = ThetaClient(dataframe_type=''pandas'')

          df = client.stock_history_ohlc(symbol=''AAPL'', interval=''1m'')

          '
      - lang: Python
        label: polars
        source: 'from thetadata import ThetaClient


          client = ThetaClient(dataframe_type=''polars'')

          df = client.stock_history_ohlc(symbol=''AAPL'', interval=''1m'')

          '
      tags:
      - History
      description: "- Aggregated OHLC bars that use [SIP rules](/Articles/Data-And-Requests/OHLC-EOD.html) for each bar. Time timestamp of the bar represents the opening time of the bar. For a trade to be part of the bar:  ``bar time`` <= ``trade time`` < ``bar timestamp + ivl``, where ivl is the specified interval size in milliseconds. \n- Set the ``venue`` parameter to ``nqb`` to access current-day real-time historic data from the [Nasdaq Basic feed](/Articles/Data-And-Requests/The-SIPs) if the account has a [stocks standard or pro subscription](https://www.thetadata.net/subscribe.html#stocks).\n- Multi-day requests are limited to 1 month of data.\n"
      x-sample-urls:
      - url: http://127.0.0.1:25503/v3/stock/history/ohlc?symbol=AAPL&date=20240102&interval=1m
        description: Returns OHLC for a given symbol on the specified date with a one minute interval
      - url: http://127.0.0.1:25503/v3/stock/history/ohlc?symbol=AAPL&date=20240102&interval=1m&format=html
        description: Click to open in browser (HTML)
      - url: http://127.0.0.1:25503/v3/stock/history/ohlc?symbol=AAPL&start_date=20240102&end_date=20240109&interval=1m
        description: Returns OHLC for a given symbol between specified dates (inclusive) with a one minute interval
      - url: http://127.0.0.1:25503/v3/stock/history/ohlc?symbol=AAPL&start_date=20240102&end_date=20240109&interval=1m&format=html
        description: Click to open in browser (HTML)
      parameters:
      - $ref: '#/components/parameters/single_symbol'
      - $ref: '#/components/parameters/opt_date'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/start_time'
      - $ref: '#/components/parameters/end_time'
      - $ref: '#/components/parameters/venue'
      - $ref: '#/components/parameters/format'
      - $ref: '#/components/parameters/opt_start_date'
      - $ref: '#/components/parameters/opt_end_date'
      responses:
        '200':
          description: Returns OHLC for a given symbol between specified dates (inclusive) with a one minute interval
          content:
            text/csv:
              schema:
                type: array
                items: &id003
                  type: object
                  properties:
                    timestamp:
                      type: string
                      format: date-time
                      description: The timestamp in YYYY-MM-DDTHH:mm:ss.SSS format.
                    open:
                      type: number
                      description: The opening trade price.
                    high:
                      type: number
                      description: The highest traded price.
                    low:
                      type: number
                      description: The lowest traded price.
                    close:
                      type: number
                      description: The closing traded price.
                    volume:
                      type: integer
                      description: The amount of contracts / shares traded.
                    count:
                      type: integer
                      description: The amount of trades.
                    vwap:
                      type: number
                      description: The volume weighted average price of the trading session.
              example: "timestamp,open,high,low,close,volume,count,vwap\r\n2024-01-02T09:30:00,187.1500,188.050,186.350,187.830,3256708,37886,187.25\r\n2024-01-02T09:31:00,187.830,188.120,187.630,187.765,809707,7481,187.38\r\n2024-01-02T09:32:00,187.770,188.440,187.730,188.2984,687086,7103,187.48\r\n2024-01-02T09:33:00,188.3050,188.310,187.810,188.160,485275,6245,187.53\r\n2024-01-02T09:34:00,188.150,188.150,187.670,187.730,415948,5942,187.55\r\n"
            application/json:
              schema: &id004
                type: array
                items: *id003
              example: "{\n  \"response\": [\n    {\"volume\":3256708,\"high\":188.050,\"low\":186.350,\"vwap\":187.25,\"count\":37886,\"close\":187.830,\"open\":187.1500,\"timestamp\":\"2024-01-02T09:30:00\"},\n    {\"volume\":809707,\"high\":188.120,\"low\":187.630,\"vwap\":187.38,\"count\":7481,\"close\":187.765,\"open\":187.830,\"timestamp\":\"2024-01-02T09:31:00\"},\n    {\"volume\":687086,\"high\":188.440,\"low\":187.730,\"vwap\":187.48,\"count\":7103,\"close\":188.2984,\"open\":187.770,\"timestamp\":\"2024-01-02T09:32:00\"},\n    {\"volume\":485275,\"high\":188.310,\"low\":187.810,\"vwap\":187.53,\"count\":6245,\"close\":188.160,\"open\":188.3050,\"timestamp\":\"2024-01-02T09:33:00\"},\n    {\"volume\":415948,\"high\":188.150,\"low\":187.670,\"vwap\":187.55,\"count\":5942,\"close\":187.730,\"open\":188.150,\"timestamp\":\"2024-01-02T09:34:00\"}\n  ]\n}\n"
            application/x-ndjson:
              schema: *id004
              example: '{"volume":3256708,"high":188.050,"low":186.350,"vwap":187.25,"count":37886,"close":187.830,"open":187.1500,"timestamp":"2024-01-02T09:30:00"}

                {"volume":809707,"high":188.120,"low":187.630,"vwap":187.38,"count":7481,"close":187.765,"open":187.830,"timestamp":"2024-01-02T09:31:00"}

                {"volume":687086,"high":188.440,"low":187.730,"vwap":187.48,"count":7103,"close":188.2984,"open":187.770,"timestamp":"2024-01-02T09:32:00"}

                {"volume":485275,"high":188.310,"low":187.810,"vwap":187.53,"count":6245,"close":188.160,"open":188.3050,"timestamp":"2024-01-02T09:33:00"}

                {"volume":415948,"high":188.150,"low":187.670,"vwap":187.55,"count":5942,"close":187.730,"open":188.150,"timestamp":"2024-01-02T09:34:00"}'
            python/pandas:
              schema: *id004
              example: 'timestamp      open      high       low     close  volume  count    vwap

                0  2025-10-02 09:30:00-04:00  256.5750  256.8300  256.2100  256.4600  929518  13659  256.57

                1  2025-10-02 09:31:00-04:00  256.4700  256.8500  256.3500  256.3700  183344   2498  256.58

                2  2025-10-02 09:32:00-04:00  256.3500  257.3000  256.2600  257.1600  388614   4928  256.64

                3  2025-10-02 09:33:00-04:00  257.1400  257.2450  256.6300  256.7500  233456   3195  256.68

                4  2025-10-02 09:34:00-04:00  256.7375  257.0500  255.8000  255.8900  224588   3292  256.65

                5  2025-10-02 09:35:00-04:00  255.8900  256.1400  255.3100  255.4000  324623   4018  256.51

                6  2025-10-02 09:36:00-04:00  255.3900  255.6200  255.1000  255.2150  176060   2968  256.44

                7  2025-10-02 09:37:00-04:00  255.2000  255.3700  255.0900  255.1450  217195   3137  256.34

                8  2025-10-02 09:38:00-04:00  255.1650  255.3050  254.8301  254.8700  285347   4128  256.22

                9  2025-10-02 09:39:00-04:00  254.8650  254.9400  254.5000  254.5550  192953   2880  256.13

                10 2025-10-02 09:40:00-04:00  254.5300  254.5600  254.1500  254.2100  262004   3643  256.00

                11 2025-10-02 09:41:00-04:00  254.2400  254.5500  254.2100  254.3600  186084   2943  255.92

                12 2025-10-02 09:42:00-04:00  254.3700  254.5744  254.2600  254.4000  200902   2464  255.84

                13 2025-10-02 09:43:00-04:00  254.4200  254.8400  254.4200  254.8100  130322   2104  255.80

                14 2025-10-02 09:44:00-04:00  254.7900  254.9600  254.7053  254.7550  185496   2400  255.76

                15 2025-10-02 09:45:00-04:00  254.7600  255.1300  254.5250  255.1106  165523   2497  255.72

                16 2025-10-02 09:46:00-04:00  255.0900  255.4199  255.0600  255.1600  137451   2204  255.71

                17 2025-10-02 09:47:00-04:00  255.1500  255.2200  254.8020  254.9650  129188   2162  255.69

                18 2025-10-02 09:48:00-04:00  254.9600  255.1850  254.9200  255.1150  136240   2052  255.67

                19 2025-10-02 09:49:00-04:00  255.1150  255.3100  255.0700  255.1400  129102   1876  255.66

                20 2025-10-02 09:50:00-04:00  255.1300  255.2200  254.9300  255.1500  118183   1781  255.64

                21 2025-10-02 09:51:00-04:00  255.1400  255.5200  255.0700  255.3900  194992   2073  255.63

                22 2025-10-02 09:52:00-04:00  255.3700  255.7400  255.3101  255.3600  125463   1782  255.63

                23 2025-10-02 09:53:00-04:00  255.4000  255.7750  255.3650  255.7350  151982   1741  255.62

                24 2025-10-02 09:54:00-04:00  255.7350  255.9750  255.6600  255.6750  141129   1799  255.63

                25 2025-10-02 09:55:00-04:00  255.6600  255.9300  255.6600  255.7900  107766   1357  255.63

                26 2025-10-02 09:56:00-04:00  255.8100  255.8444  255.6900  255.7400   66568   1103  255.64

                27 2025-10-02 09:57:00-04:00  255.7650  255.7650  255.5300  255.5750   85323   1332  255.64

                28 2025-10-02 09:58:00-04:00  255.5700  255.9700  255.5500  255.9700  132838   1663  255.64

                29 2025-10-02 09:59:00-04:00  255.9650  256.0800  255.8700  256.0350  204495   1973  255.65

                30 2025-10-02 10:00:00-04:00       NaN       NaN       NaN       NaN       0      0  255.65

                '
            python/polars:
              schema: *id004
              example: 'shape: (31, 8)

                ┌────────────────────────────────┬──────────┬──────────┬────────┬─────────┬────────┬───────┬────────┐

                │ timestamp                      ┆ open     ┆ high     ┆ low    ┆ close   ┆ volume ┆ count ┆ vwap   │

                │ ---                            ┆ ---      ┆ ---      ┆ ---    ┆ ---     ┆ ---    ┆ ---   ┆ ---    │

                │ datetime[ms, America/New_York] ┆ f64      ┆ f64      ┆ f64    ┆ f64     ┆ i64    ┆ i64   ┆ f64    │

                ╞════════════════════════════════╪══════════╪══════════╪════════╪═════════╪════════╪═══════╪════════╡

                │ 2025-10-02 09:30:00 EDT        ┆ 256.575  ┆ 256.83   ┆ 256.21 ┆ 256.46  ┆ 929518 ┆ 13659 ┆ 256.57 │

                │ 2025-10-02 09:31:00 EDT        ┆ 256.47   ┆ 256.85   ┆ 256.35 ┆ 256.37  ┆ 183344 ┆ 2498  ┆ 256.58 │

                │ 2025-10-02 09:32:00 EDT        ┆ 256.35   ┆ 257.3    ┆ 256.26 ┆ 257.16  ┆ 388614 ┆ 4928  ┆ 256.64 │

                │ 2025-10-02 09:33:00 EDT        ┆ 257.14   ┆ 257.245  ┆ 256.63 ┆ 256.75  ┆ 233456 ┆ 3195  ┆ 256.68 │

                │ 2025-10-02 09:34:00 EDT        ┆ 256.7375 ┆ 257.05   ┆ 255.8  ┆ 255.89  ┆ 224588 ┆ 3292  ┆ 256.65 │

                │ …                              ┆ …        ┆ …        ┆ …      ┆ …       ┆ …      ┆ …     ┆ …      │

                │ 2025-10-02 09:56:00 EDT        ┆ 255.81   ┆ 255.8444 ┆ 255.69 ┆ 255.74  ┆ 66568  ┆ 1103  ┆ 255.64 │

                │ 2025-10-02 09:57:00 EDT        ┆ 255.765  ┆ 255.765  ┆ 255.53 ┆ 255.575 ┆ 85323  ┆ 1332  ┆ 255.64 │

                │ 2025-10-02 09:58:00 EDT        ┆ 255.57   ┆ 255.97   ┆ 255.55 ┆ 255.97  ┆ 132838 ┆ 1663  ┆ 255.64 │

                │ 2025-10-02 09:59:00 EDT        ┆ 255.965  ┆ 256.08   ┆ 255.87 ┆ 256.035 ┆ 204495 ┆ 1973  ┆ 255.65 │

                │ 2025-10-02 10:00:00 EDT        ┆ NaN      ┆ NaN      ┆ NaN    ┆ NaN     ┆ 0      ┆ 0     ┆ 255.65 │

                └────────────────────────────────┴──────────┴──────────┴────────┴─────────┴────────┴───────┴────────┘

                '
  /stock/history/trade:
    x-concurrent-limit-ttl-ms: '365'
    x-min-subscription: standard
    x-history-access: true
    get:
      summary: Trade
      operationId: stock_history_trade
      x-codeSamples:
      - lang: Python
        label: pandas
        source: 'from thetadata import ThetaClient


          client = ThetaClient(dataframe_type=''pandas'')

          df = client.stock_history_trade(symbol=''AAPL'')

          '
      - lang: Python
        label: polars
        source: 'from thetadata import ThetaClient


          client = ThetaClient(dataframe_type=''polars'')

          df = client.stock_history_trade(symbol=''AAPL'')

          '
      tags:
      - History
      description: 'Returns every trade reported by [UTP & CTA](/Articles/Data-And-Requests/The-SIPs). Set the ``venue`` parameter to ``nqb`` to access current-day real-time historic data from the [Nasdaq Basic feed](/Articles/Data-And-Requests/The-SIPs) if the account has a [stocks standard or pro subscription](https://www.thetadata.net/subscribe.html#stocks).

        - Multi-day requests are limited to 1 month of data.

        '
      x-sample-urls:
      - url: http://127.0.0.1:25503/v3/stock/history/trade?symbol=AAPL&date=20240102
        description: Returns every trade for a given symbol on specified date
      - url: http://127.0.0.1:25503/v3/stock/history/trade?symbol=AAPL&date=20240102&format=html
        description: Click to open in browser (HTML)
      - url: http://127.0.0.1:25503/v3/stock/history/trade?symbol=AAPL&start_date=20240102&end_date=20240105
        description: Returns every trade for a given symbol between specified dates (inclusive)
      - url: http://127.0.0.1:25503/v3/stock/history/trade?symbol=AAPL&start_date=20240102&end_date=20240105&format=html
        description: Click to open in browser (HTML)
      parameters:
      - $ref: '#/components/parameters/single_symbol'
      - $ref: '#/components/parameters/opt_date'
      - $ref: '#/components/parameters/start_time'
      - $ref: '#/components/parameters/end_time'
      - $ref: '#/components/parameters/venue'
      - $ref: '#/components/parameters/format'
      - $ref: '#/components/parameters/opt_start_date'
      - $ref: '#/components/parameters/opt_end_date'
      responses:
        '200':
          description: Returns every trade for a given symbol between specified dates (inclusive) with a one minute interval
          content:
            text/csv:
              schema:
                type: array
                items: &id005
                  type: object
                  properties:
                    timestamp:
                      type: string
                      format: date-time
                      description: The timestamp in YYYY-MM-DDTHH:mm:ss.SSS format.
                    sequence:
                      type: integer
                      description: The exchange [sequence](/Articles/Data-And-Requests/Making-Requests.html#trade-sequences).
                    ext_condition1:
                      type: integer
                      description: Additional trade [condition](/Articles/Errors-Exchanges-Conditions/Trade-Conditions.html)(s). These can be ignored for options.
                    ext_condition2:
                      type: integer
                      description: Additional trade [condition](/Articles/Errors-Exchanges-Conditions/Trade-Conditions.html)(s). These can be ignored for options.
                    ext_condition3:
                      type: integer
                      description: Additional trade [condition](/Articles/Errors-Exchanges-Conditions/Trade-Conditions.html)(s). These can be ignored for options.
                    ext_condition4:
                      type: integer
                      description: Additional trade [condition](/Articles/Errors-Exchanges-Conditions/Trade-Conditions.html)(s). These can be ignored for options.
                    condition:
                      type: integer
                      description: The trade [condition](/Articles/Errors-Exchanges-Conditions/Trade-Conditions.html).
                    size:
                      type: integer
                      description: The amount of contracts / shares traded.
                    exchange:
                      type: integer
                      description: The [exchange](/Articles/Errors-Exchanges-Conditions/Exchanges.html) the trade was executed.
                    price:
                      type: number
                      description: The trade price.
              example: "timestamp,sequence,ext_condition1,ext_condition2,ext_condition3,ext_condition4,condition,size,exchange,price\r\n2024-01-02T09:30:00.011,14920,32,95,1,115,1,2,7,187.1800\r\n2024-01-02T09:30:00.014,8931,32,255,1,115,1,1,1,187.1800\r\n2024-01-02T09:30:00.014,8932,32,255,1,115,1,5,1,187.1800\r\n2024-01-02T09:30:00.014,8933,32,255,1,115,1,3,1,187.1900\r\n2024-01-02T09:30:00.014,8934,32,255,1,115,1,91,1,187.1900\r\n"
            application/json:
              schema: &id006
                type: array
                items: *id005
              example: "{\n  \"response\": [\n    {\"sequence\":14920,\"condition\":1,\"size\":2,\"price\":187.1800,\"ext_condition2\":95,\"ext_condition1\":32,\"ext_condition4\":115,\"exchange\":7,\"ext_condition3\":1,\"timestamp\":\"2024-01-02T09:30:00.011\"},\n    {\"sequence\":8931,\"condition\":1,\"size\":1,\"price\":187.1800,\"ext_condition2\":255,\"ext_condition1\":32,\"ext_condition4\":115,\"exchange\":1,\"ext_condition3\":1,\"timestamp\":\"2024-01-02T09:30:00.014\"},\n    {\"sequence\":8932,\"condition\":1,\"size\":5,\"price\":187.1800,\"ext_condition2\":255,\"ext_condition1\":32,\"ext_condition4\":115,\"exchange\":1,\"ext_condition3\":1,\"timestamp\":\"2024-01-02T09:30:00.014\"},\n    {\"sequence\":8933,\"condition\":1,\"size\":3,\"price\":187.1900,\"ext_condition2\":255,\"ext_condition1\":32,\"ext_condition4\":115,\"exchange\":1,\"ext_condition3\":1,\"timestamp\":\"2024-01-02T09:30:00.014\"},\n    {\"sequence\":8934,\"condition\":1,\"size\":91,\"price\":187.1900,\"ext_condition2\":255,\"ext_condition1\":3

# --- truncated at 32 KB (468 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/thetadata/refs/heads/main/openapi/thetadata-history-api-openapi.yml