Get Time and Sales Data
Code Example
# Version 3.6.1
import csv
from datetime import datetime, timedelta
import json
import requests
import sys
API_KEY = <TOKEN>
response = requests.get('https://api.tradier.com/v1/markets/timesales',
params={'symbol':'AAPL', 'interval': '1min', 'start': '2025-09-25 09:30', 'end': '2025-09-25 10:30', 'session_filter': 'open'},
headers={'Authorization': f'Bearer {API_KEY}', 'Accept': 'application/json'}
)
try:
json_response = response.json()
except Exception as e:
print (e)
print(response)
print(response.text)
sys.exit(1)
if 'series' in json_response.keys():
if json_response['series'] is None:
print(json_response)
print("json_response is None")
else:
data = json_response['series']['data']
if type(data) is list:
for item in data:
print(item)
else:
print(data)
else:
print(json_response)
Response Example
{'time': '2025-09-25T09:30:00', 'timestamp': 1758807000, 'price': 253.41005, 'open': 253.35, 'high': 254.32, 'low': 252.5001, 'close': 252.6901, 'volume': 1234413, 'vwap': 253.42805}
{'time': '2025-09-25T09:31:00', 'timestamp': 1758807060, 'price': 252.36, 'open': 252.7, 'high': 252.75, 'low': 251.97, 'close': 252.445, 'volume': 384715, 'vwap': 252.31268}
{'time': '2025-09-25T09:32:00', 'timestamp': 1758807120, 'price': 252.56504999999999, 'open': 252.48, 'high': 252.98, 'low': 252.1501, 'close': 252.23, 'volume': 312947, 'vwap': 252.51962}
{'time': '2025-09-25T09:33:00', 'timestamp': 1758807180, 'price': 252.51, 'open': 252.265, 'high': 252.83, 'low': 252.19, 'close': 252.56, 'volume': 249513, 'vwap': 252.53244}
{'time': '2025-09-25T09:34:00', 'timestamp': 1758807240, 'price': 252.29, 'open': 252.57, 'high': 252.6, 'low': 251.98, 'close': 252.01, 'volume': 248885, 'vwap': 252.2196}
{'time': '2025-09-25T09:35:00', 'timestamp': 1758807300, 'price': 252.006, 'open': 252.01, 'high': 252.3, 'low': 251.712, 'close': 252.14, 'volume': 384087, 'vwap': 251.94752}
{'time': '2025-09-25T09:36:00', 'timestamp': 1758807360, 'price': 252.45, 'open': 252.15, 'high': 252.75, 'low': 252.15, 'close': 252.615, 'volume': 226746, 'vwap': 252.56814}
{'time': '2025-09-25T09:37:00', 'timestamp': 1758807420, 'price': 252.855, 'open': 252.625, 'high': 253.23, 'low': 252.48, 'close': 253.15, 'volume': 403100, 'vwap': 252.87479}
{'time': '2025-09-25T09:38:00', 'timestamp': 1758807480, 'price': 253.085, 'open': 253.1742, 'high': 253.34, 'low': 252.83, 'close': 252.9556, 'volume': 274522, 'vwap': 253.07665}
{'time': '2025-09-25T09:39:00', 'timestamp': 1758807540, 'price': 252.88, 'open': 252.96, 'high': 253.16, 'low': 252.6, 'close': 252.88, 'volume': 217812, 'vwap': 252.8723}
{'time': '2025-09-25T09:40:00', 'timestamp': 1758807600, 'price': 252.585, 'open': 252.8953, 'high': 252.96, 'low': 252.21, 'close': 252.28, 'volume': 262997, 'vwap': 252.53439}
{'time': '2025-09-25T09:41:00', 'timestamp': 1758807660, 'price': 252.24995, 'open': 252.275, 'high': 252.4999, 'low': 252.0, 'close': 252.04, 'volume': 168365, 'vwap': 252.21551}
{'time': '2025-09-25T09:42:00', 'timestamp': 1758807720, 'price': 252.05505, 'open': 252.04, 'high': 252.27, 'low': 251.8401, 'close': 252.2599, 'volume': 209794, 'vwap': 252.0595}
{'time': '2025-09-25T09:43:00', 'timestamp': 1758807780, 'price': 252.57, 'open': 252.27, 'high': 252.92, 'low': 252.22, 'close': 252.835, 'volume': 199889, 'vwap': 252.58579}
{'time': '2025-09-25T09:44:00', 'timestamp': 1758807840, 'price': 252.75560000000002, 'open': 252.835, 'high': 252.94, 'low': 252.5712, 'close': 252.71, 'volume': 195692, 'vwap': 252.74924}
{'time': '2025-09-25T09:45:00', 'timestamp': 1758807900, 'price': 252.77499999999998, 'open': 252.7025, 'high': 253.04, 'low': 252.51, 'close': 252.72, 'volume': 238656, 'vwap': 252.75404}
{'time': '2025-09-25T09:46:00', 'timestamp': 1758807960, 'price': 252.93, 'open': 252.715, 'high': 253.17, 'low': 252.69, 'close': 253.0, 'volume': 121497, 'vwap': 252.95766}
{'time': '2025-09-25T09:47:00', 'timestamp': 1758808020, 'price': 253.17000000000002, 'open': 252.965, 'high': 253.43, 'low': 252.91, 'close': 253.24, 'volume': 208538, 'vwap': 253.14761}
{'time': '2025-09-25T09:48:00', 'timestamp': 1758808080, 'price': 253.06005, 'open': 253.23, 'high': 253.23, 'low': 252.8901, 'close': 253.04, 'volume': 202516, 'vwap': 253.07784}
{'time': '2025-09-25T09:49:00', 'timestamp': 1758808140, 'price': 253.16, 'open': 252.99, 'high': 253.34, 'low': 252.98, 'close': 253.14, 'volume': 299774, 'vwap': 253.11835}
{'time': '2025-09-25T09:50:00', 'timestamp': 1758808200, 'price': 253.425, 'open': 253.15, 'high': 253.74, 'low': 253.11, 'close': 253.6003, 'volume': 216942, 'vwap': 253.51893}
{'time': '2025-09-25T09:51:00', 'timestamp': 1758808260, 'price': 253.69, 'open': 253.63, 'high': 253.92, 'low': 253.46, 'close': 253.49, 'volume': 262413, 'vwap': 253.71556}
{'time': '2025-09-25T09:52:00', 'timestamp': 1758808320, 'price': 253.39999999999998, 'open': 253.485, 'high': 253.6, 'low': 253.2, 'close': 253.27, 'volume': 141368, 'vwap': 253.44549}
{'time': '2025-09-25T09:53:00', 'timestamp': 1758808380, 'price': 253.03005000000002, 'open': 253.28, 'high': 253.28, 'low': 252.7801, 'close': 253.035, 'volume': 233362, 'vwap': 252.96338}
{'time': '2025-09-25T09:54:00', 'timestamp': 1758808440, 'price': 252.93995, 'open': 253.03, 'high': 253.0799, 'low': 252.8, 'close': 252.84, 'volume': 94228, 'vwap': 252.95363}
{'time': '2025-09-25T09:55:00', 'timestamp': 1758808500, 'price': 252.76999999999998, 'open': 252.84, 'high': 252.89, 'low': 252.65, 'close': 252.76, 'volume': 109545, 'vwap': 252.7871}
{'time': '2025-09-25T09:56:00', 'timestamp': 1758808560, 'price': 252.70499999999998, 'open': 252.7608, 'high': 252.79, 'low': 252.62, 'close': 252.7765, 'volume': 92301, 'vwap': 252.69461}
{'time': '2025-09-25T09:57:00', 'timestamp': 1758808620, 'price': 252.6175, 'open': 252.765, 'high': 252.765, 'low': 252.47, 'close': 252.69, 'volume': 111904, 'vwap': 252.61064}
{'time': '2025-09-25T09:58:00', 'timestamp': 1758808680, 'price': 252.395, 'open': 252.72, 'high': 252.74, 'low': 252.05, 'close': 252.1, 'volume': 213950, 'vwap': 252.31551}
{'time': '2025-09-25T09:59:00', 'timestamp': 1758808740, 'price': 252.155, 'open': 252.1, 'high': 252.34, 'low': 251.97, 'close': 252.31, 'volume': 181803, 'vwap': 252.16738}
{'time': '2025-09-25T10:00:00', 'timestamp': 1758808800, 'price': 252.37, 'open': 252.33, 'high': 252.62, 'low': 252.12, 'close': 252.6, 'volume': 230734, 'vwap': 252.37421}
{'time': '2025-09-25T10:01:00', 'timestamp': 1758808860, 'price': 252.45, 'open': 252.63, 'high': 252.68, 'low': 252.22, 'close': 252.48, 'volume': 117218, 'vwap': 252.48093}
{'time': '2025-09-25T10:02:00', 'timestamp': 1758808920, 'price': 252.66, 'open': 252.5, 'high': 252.89, 'low': 252.43, 'close': 252.7201, 'volume': 242630, 'vwap': 252.74441}
{'time': '2025-09-25T10:03:00', 'timestamp': 1758808980, 'price': 252.83255, 'open': 252.735, 'high': 253.0951, 'low': 252.57, 'close': 252.9897, 'volume': 218655, 'vwap': 252.9188}
{'time': '2025-09-25T10:04:00', 'timestamp': 1758809040, 'price': 253.065, 'open': 253.0, 'high': 253.22, 'low': 252.91, 'close': 253.115, 'volume': 117525, 'vwap': 253.0542}
{'time': '2025-09-25T10:05:00', 'timestamp': 1758809100, 'price': 253.41575, 'open': 253.12, 'high': 253.73, 'low': 253.1015, 'close': 253.7, 'volume': 158109, 'vwap': 253.39952}
{'time': '2025-09-25T10:06:00', 'timestamp': 1758809160, 'price': 253.72255, 'open': 253.7074, 'high': 253.8369, 'low': 253.6082, 'close': 253.625, 'volume': 142886, 'vwap': 253.72432}
{'time': '2025-09-25T10:07:00', 'timestamp': 1758809220, 'price': 253.575, 'open': 253.625, 'high': 253.78, 'low': 253.37, 'close': 253.384, 'volume': 111817, 'vwap': 253.61335}
{'time': '2025-09-25T10:08:00', 'timestamp': 1758809280, 'price': 253.425, 'open': 253.3801, 'high': 253.55, 'low': 253.3, 'close': 253.38, 'volume': 106751, 'vwap': 253.42198}
{'time': '2025-09-25T10:09:00', 'timestamp': 1758809340, 'price': 253.44, 'open': 253.39, 'high': 253.51, 'low': 253.37, 'close': 253.465, 'volume': 73668, 'vwap': 253.44304}
{'time': '2025-09-25T10:10:00', 'timestamp': 1758809400, 'price': 253.5215, 'open': 253.4788, 'high': 253.75, 'low': 253.293, 'close': 253.7092, 'volume': 90625, 'vwap': 253.50384}
{'time': '2025-09-25T10:11:00', 'timestamp': 1758809460, 'price': 253.70499999999998, 'open': 253.735, 'high': 253.81, 'low': 253.6, 'close': 253.64, 'volume': 115508, 'vwap': 253.71066}
{'time': '2025-09-25T10:12:00', 'timestamp': 1758809520, 'price': 253.67000000000002, 'open': 253.66, 'high': 253.78, 'low': 253.56, 'close': 253.585, 'volume': 86217, 'vwap': 253.64856}
{'time': '2025-09-25T10:13:00', 'timestamp': 1758809580, 'price': 253.695, 'open': 253.585, 'high': 253.83, 'low': 253.56, 'close': 253.743, 'volume': 93591, 'vwap': 253.70504}
{'time': '2025-09-25T10:14:00', 'timestamp': 1758809640, 'price': 253.675, 'open': 253.75, 'high': 253.8, 'low': 253.55, 'close': 253.56, 'volume': 88243, 'vwap': 253.66748}
{'time': '2025-09-25T10:15:00', 'timestamp': 1758809700, 'price': 253.595, 'open': 253.6, 'high': 253.75, 'low': 253.44, 'close': 253.48, 'volume': 83634, 'vwap': 253.60733}
{'time': '2025-09-25T10:16:00', 'timestamp': 1758809760, 'price': 253.46994999999998, 'open': 253.4647, 'high': 253.5999, 'low': 253.34, 'close': 253.4, 'volume': 62724, 'vwap': 253.42656}
{'time': '2025-09-25T10:17:00', 'timestamp': 1758809820, 'price': 253.235, 'open': 253.38, 'high': 253.39, 'low': 253.08, 'close': 253.095, 'volume': 113498, 'vwap': 253.25974}
{'time': '2025-09-25T10:18:00', 'timestamp': 1758809880, 'price': 253.255, 'open': 253.09, 'high': 253.42, 'low': 253.09, 'close': 253.42, 'volume': 104466, 'vwap': 253.23618}
{'time': '2025-09-25T10:19:00', 'timestamp': 1758809940, 'price': 253.49435, 'open': 253.4, 'high': 253.6516, 'low': 253.3371, 'close': 253.45, 'volume': 81800, 'vwap': 253.47642}
{'time': '2025-09-25T10:20:00', 'timestamp': 1758810000, 'price': 253.6, 'open': 253.49, 'high': 253.75, 'low': 253.45, 'close': 253.58, 'volume': 115745, 'vwap': 253.61796}
{'time': '2025-09-25T10:21:00', 'timestamp': 1758810060, 'price': 253.66500000000002, 'open': 253.59, 'high': 253.78, 'low': 253.55, 'close': 253.735, 'volume': 95618, 'vwap': 253.69018}
{'time': '2025-09-25T10:22:00', 'timestamp': 1758810120, 'price': 253.805, 'open': 253.73, 'high': 253.9, 'low': 253.71, 'close': 253.8627, 'volume': 74411, 'vwap': 253.81051}
{'time': '2025-09-25T10:23:00', 'timestamp': 1758810180, 'price': 253.87005, 'open': 253.85, 'high': 253.97, 'low': 253.7701, 'close': 253.9, 'volume': 113618, 'vwap': 253.88546}
{'time': '2025-09-25T10:24:00', 'timestamp': 1758810240, 'price': 253.97505, 'open': 253.9, 'high': 254.08, 'low': 253.8701, 'close': 253.99, 'volume': 125266, 'vwap': 253.9701}
{'time': '2025-09-25T10:25:00', 'timestamp': 1758810300, 'price': 253.89499999999998, 'open': 253.985, 'high': 254.04, 'low': 253.75, 'close': 253.7669, 'volume': 104192, 'vwap': 253.90282}
{'time': '2025-09-25T10:26:00', 'timestamp': 1758810360, 'price': 253.80925, 'open': 253.77, 'high': 253.8799, 'low': 253.7386, 'close': 253.84, 'volume': 584054, 'vwap': 253.8357}
{'time': '2025-09-25T10:27:00', 'timestamp': 1758810420, 'price': 253.99005, 'open': 253.88, 'high': 254.12, 'low': 253.8601, 'close': 254.08, 'volume': 123190, 'vwap': 254.01178}
{'time': '2025-09-25T10:28:00', 'timestamp': 1758810480, 'price': 253.98545000000001, 'open': 254.075, 'high': 254.1199, 'low': 253.851, 'close': 253.86, 'volume': 98039, 'vwap': 254.0116}
{'time': '2025-09-25T10:29:00', 'timestamp': 1758810540, 'price': 253.91000000000003, 'open': 253.89, 'high': 254.05, 'low': 253.77, 'close': 254.0, 'volume': 104597, 'vwap': 253.9311}
{'time': '2025-09-25T10:30:00', 'timestamp': 1758810600, 'price': 253.98005, 'open': 254.02, 'high': 254.1, 'low': 253.8601, 'close': 254.035, 'volume': 143318, 'vwap': 253.94105}
Step-by-Step Explainer:
Imports
For our imports/libraries, we need the ability to make HTTP requests and to parse JSON so 'requests' and 'JSON' are necessary in Python and something similar in whatever language you are using.
Other useful tools for time and sales data can include the datetime library if we want to capture slices of time that are dynamic rather than static, and a CSV library for outputting data in a useful format.
API Token
We will, of course, need your API token from https://web.tradier.com/settings/api to authenticate.
Symbol
We can enter the symbol for which we want time and sales data as a variable or we can hard-code it in our call.
The Request
For this request, we have simple parameters hard-coded, with the exception of our API token. The intent of the request is to gather 1-minute bars for a one-hour block of time.
Check the Response
We check for JSON in our response, and if the response is not in a JSON format, it must be an error, which can be found in the response.text
Checking for data in the JSON response
If there is data to be found, it will be nested under the key 'series'. If this key is none and you expected to have time and sales data, check your parameters and possibly reach out to the tech support team.
Printing Good Data
If we do have data attached to the 'series' key it will be further nested under the 'data' key, and the value of that will be a dict for a single item, such as a single bar or a list for multiple items.
Fall back
Always good to have a fallback where the response is just printed to see what it contains in the event of an edge case
On this page
- Get Time and Sales Data