Skip to content

History

Get historical OHLCV (Open, High, Low, Close, Volume) data for a symbol.

Endpoint URL

http
Local Host   :  POST http://127.0.0.1:5000/api/v1/history
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/history
Custom Domain:  POST https://<your-custom-domain>/api/v1/history

Sample API Request

json
{
  "apikey": "<your_app_apikey>",
  "symbol": "SBIN",
  "exchange": "NSE",
  "interval": "5m",
  "start_date": "2025-04-01",
  "end_date": "2025-04-08"
}

Sample cURL Request

bash
curl -X POST http://127.0.0.1:5000/api/v1/history \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "symbol": "SBIN",
  "exchange": "NSE",
  "interval": "5m",
  "start_date": "2025-04-01",
  "end_date": "2025-04-08"
}'

Sample API Response

json
{
  "status": "success",
  "data": [
    {
      "timestamp": 1743480300,
      "open": 766.50,
      "high": 774.00,
      "low": 763.20,
      "close": 772.50,
      "volume": 318625,
      "oi": 0
    },
    {
      "timestamp": 1743480600,
      "open": 772.45,
      "high": 774.95,
      "low": 772.10,
      "close": 773.20,
      "volume": 197189,
      "oi": 0
    },
    {
      "timestamp": 1743480900,
      "open": 773.20,
      "high": 775.60,
      "low": 772.60,
      "close": 775.15,
      "volume": 227544,
      "oi": 0
    }
  ]
}

Request Body

ParameterDescriptionMandatory/OptionalDefault Value
apikeyYour Tradeboard API keyMandatory-
symbolTrading symbolMandatory-
exchangeAny value in the shared VALID_EXCHANGES listMandatory-
intervalTime interval (see below)Mandatory-
start_dateStart date (YYYY-MM-DD)Mandatory-
end_dateEnd date (YYYY-MM-DD)Mandatory-
sourceData source: api (broker) or db (local Historify/DuckDB store)Optionalapi

These seven fields are the complete HistorySchema. Any other field returns HTTP 400.

source accepts only the two literal strings api and db. broker is not a valid value and returns HTTP 400; use api for broker data. source: "db" reads candles previously downloaded by Historify and returns HTTP 404 with a "Download data first using Historify" message when the local store has nothing for that symbol, exchange, and interval.

Open interest is always included for F&O symbols; there is no flag to request it.

Supported Intervals

The schema validates interval against this exact list. A value outside it returns HTTP 400, and a value inside it can still be rejected by a broker that does not offer that interval.

GroupValues
Seconds1s, 5s, 10s, 15s, 30s, 45s
Minutes1m, 2m, 3m, 5m, 10m, 15m, 20m, 30m
Hours1h, 2h, 3h, 4h
Daily and longerD (daily), W (weekly), M (monthly), Q (quarterly), Y (yearly)

Call Intervals to see which of these the connected broker actually supports.

Response Fields

FieldTypeDescription
statusstring"success" or "error"
dataarrayArray of OHLCV candles

Data Array Fields

FieldTypeDescription
timestampnumberCandle timestamp as a Unix epoch value in seconds
opennumberOpening price
highnumberHighest price
lownumberLowest price
closenumberClosing price
volumenumberVolume traded
oinumberOpen interest. Always present; 0 when the instrument or broker has none

Notes

  • Historical data availability depends on broker
  • Response timestamps are Unix epoch seconds, not formatted date strings. Convert them to whatever timezone the client needs; do not treat the numeric value itself as an IST-local timestamp.
  • For intraday intervals, data is typically available for the last 30-90 days
  • For daily data, longer history may be available
  • Use Intervals endpoint to check available intervals for your broker

Example: Reading From The Local Historify Store

json
{
  "apikey": "<your_app_apikey>",
  "symbol": "SBIN",
  "exchange": "NSE",
  "interval": "5m",
  "start_date": "2025-04-01",
  "end_date": "2025-04-08",
  "source": "db"
}

Example: Daily Data

json
{
  "apikey": "<your_app_apikey>",
  "symbol": "RELIANCE",
  "exchange": "NSE",
  "interval": "D",
  "start_date": "2024-01-01",
  "end_date": "2025-01-01"
}

Back to: API Documentation