Historical Data
Overview
'/history' endpoint provides the historical data for a symbol from the most recent quote update.
Key Features:
- Supports both GET and POST requests
- Includes the current price
- Up to 20k data point (ticks) from the most recent quote update
- Same response format as '/latest' or '/realtime' endpoints for easier intergration with the new series data
GET request
https://insightsentry.p.rapidapi.com/v1/history?code=NASDAQ:AAPL&interval=300&interval_type=minute
POST request
{
"code": "NASDAQ:AAPL",
"interval": 1000,
"interval_type": "minute"
}
Request Parameter
If you set `interval_type` to `'day'` and `interval` to `20000`, you will retrieve up to 20,000 days of data from the most recent update.
Likewise, if you set 'interval_type' to 'second' and 'interval' to 20000, you will retrieve the last 20000 seconds of data from the most recent update.
Response Data
{
"code": "NASDAQ:AAPL",
"next_start": 1733432340,
"bar_type": "minute",
"series": [
// omitted for brevity
{
"time": 1733432220,
"open": 242.815,
"high": 242.95,
"low": 242.7428,
"close": 242.9395,
"volume": 131905
},
{
"time": 1733432280,
"open": 242.94,
"high": 243.05,
"low": 242.87,
"close": 242.89,
"volume": 193484
},
{
"time": 1733432340, // most recent bar
"open": 242.89,
"high": 243.09,
"low": 242.82,
"close": 243.08, // current price
"volume": 533779
}
]
}
Response Fields
Code Examples
import requests
url = "https://insightsentry.p.rapidapi.com/v1/history"
headers = {
"x-rapidapi-key": "<your key>",
"x-rapidapi-host": "insightsentry.p.rapidapi.com"
}
data = {
"code": "NASDAQ:AAPL",
"interval": 300,
"interval_type": "minute",
"interval_length": 1
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
# or you can also use GET request
response = requests.get("https://insightsentry.p.rapidapi.com/v1/history?code=NASDAQ:AAPL&interval=300&interval_type=minute&interval_length=1", headers=headers)
print(response.text)