Skip to content

Trade At Time

StandardPro

REQUIRED

The Theta Terminal must be running to access data.

Behavior

Returns the last trade reported by OPRA at a specified millisecond of the day.
Trade condition mappings can be found here.
Extended trade conditions are not reported by OPRA for options, so they can be ignored.
The ivlparameter represents the milliseconds since 00:00:00.000 ET that the trade should be provided for.

Sample URL & Code

Paste the URL below into your browser while the Theta Terminal is running.
You can use the "request sample" box to the right of this box obtain sample
code in any programming language.

http://127.0.0.1:25510/v2/at_time/option/trade?root=SPY&exp=20240119&strike=470000&right=C&start_date=20240116&end_date=20240116&ivl=44100000

Parameters

Query Parameters

rootRequired  -

The symbol of the security. Option underlyings for indices might have special tickers.

Type: string (Default: SPX)
expRequired  -

The expiration date of the option contract formatted as YYYYMMDD.

Type: integer (Default: 20231103)
strikeRequired  -

The strike price in 1/10th of a cent. A $170.00 strike price would be 170000.

Type: integer (Default: 170000)
rightRequired  -

The right of the option. 'C' for call; 'P' for put.

Type: string (Default: C)
EnumC, P
start_dateRequired  -

The start date (inclusive) of the request formatted as YYYYMMDD.

Type: integer (Default: 20230915)
end_dateRequired  -

The end date (inclusive) of the request formatted as YYYYMMDD.

Type: integer (Default: 20230915)
use_csvRequired  -

Uses CSV if true, legacy JSON if false.

Type: boolean (Default: false)
ivlRequired  -

The number of milliseconds since 00:00:00.000 ET. Example: 09:30:00 ET = 34200000 & 16:00:00 ET = 57600000.

Type: integer
rth  -

If this value is set to false and the request is for aggregated / intervalized data, the response will contain intervals from 00:00:000 ET to 23:59:999 ET. If the ivl is 0 or is unspecified, then rth will be forced to false. This means that all data for the day, even if it was outside regular trading hours would be returned. The default behavior is to only return data during regular trading hours (09:30:00.000 ET to 16:00.000 ET).

Type: boolean (Default: true)

Responses

OK
JSON
{
"header": {
"id": 0,
"latency_ms": 0,
"error_type": "string",
"error_msg": "string",
"next_page": null,
"format": [
"ms_of_day",
"sequence",
"ext_condition1",
"ext_condition2",
"ext_condition3",
"ext_condition4",
"condition",
"size",
"exchange",
"price",
"condition_flags",
"price_flags",
"volume_type",
"records_back",
"date"
]
},
"response": [
[
43860664,
602567584,
255,
255,
255,
255,
125,
1,
43,
5.84,
0,
1,
0,
0,
20240116
]
]
}

Sample Code

py