pocketful logo light
pocketful logo light

Historical Data NFO

This guide walks you through making your first request to the Historical Market Data API.


Base URL

https://algo.pocketful.in

Replace https://algo.pocketful.in with your production API endpoint.


Authentication

Every request must include a valid API token in the Authorization header.

Authorization: Bearer YOUR_ACCESS_TOKEN

or

Authorization: YOUR_ACCESS_TOKEN

Supported Product Types

Product TypeDescription
futuresFutures Contracts
optionsOptions Contracts

Supported Intervals

Interval
1minute
3minute
5minute
10minute
15minute
30minute
60minute
1day

Example 1 — Fetch Futures Historical Data

Endpoint

POST /api/data/v1/historical

Request Body

{
    "symbol": "BANKNIFTY",
    "product_type": "futures",
    "expiry_date": "2025-01-29",
    "interval": "1minute",
    "from_date": "2025-01-01T09:15:00",
    "to_date": "2025-01-01T15:30:00"
}

CURL

curl --location 'https://algo.pocketful.in/api/data/v1/historical' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
    "symbol": "BANKNIFTY",
    "product_type": "futures",
    "expiry_date": "2025-01-29",
    "interval": "1minute",
    "from_date": "2025-01-01T09:15:00",
    "to_date": "2025-01-01T15:30:00"
}'

Example 2 — Fetch Call Option Historical Data

Endpoint

POST /api/data/v1/historical

Request Body

{
    "symbol": "BANKNIFTY",
    "product_type": "options",
    "type": "CE",
    "strike_price": 51000,
    "expiry_date": "2025-01-29",
    "interval": "1minute",
    "from_date": "2025-01-01T09:15:00",
    "to_date": "2025-01-01T15:30:00"
}

CURL

curl --location 'https://algo.pocketful.in/api/data/v1/historical' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
    "symbol": "BANKNIFTY",
    "product_type": "options",
    "type": "CE",
    "strike_price": 51000,
    "expiry_date": "2025-01-29",
    "interval": "1minute",
    "from_date": "2025-01-01T09:15:00",
    "to_date": "2025-01-01T15:30:00"
}'

Example 3 — Fetch Put Option Historical Data

Endpoint

POST /api/data/v1/historical

Request Body

{
    "symbol": "BANKNIFTY",
    "product_type": "options",
    "type": "PE",
    "strike_price": 51000,
    "expiry_date": "2025-01-29",
    "interval": "1minute",
    "from_date": "2025-01-01T09:15:00",
    "to_date": "2025-01-01T15:30:00"
}

CURL

curl --location 'https://algo.pocketful.in/api/data/v1/historical' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
    "symbol": "BANKNIFTY",
    "product_type": "options",
    "type": "PE",
    "strike_price": 51000,
    "expiry_date": "2025-01-29",
    "interval": "1minute",
    "from_date": "2025-01-01T09:15:00",
    "to_date": "2025-01-01T15:30:00"
}'

Successful Response

The API returns an optimized lightweight response containing a candles array where each record is formatted as [timestamp, open, high, low, close, volume, open_interest].

{
  "status": "success",
  "data": {
    "candles": [
      [
        "2025-01-01T09:15:00+0530",
        51160,
        51318.75,
        51160,
        51272.85,
        2253300,
        8805
      ],
      [
        "2025-01-01T09:16:00+0530",
        51256.75,
        51266.8,
        51100,
        51126,
        2253300,
        16725
      ]
    ]
  }
}

Candle Data Structure

Each item in the candles array is an ordered array representing [timestamp, open, high, low, close, volume, open_interest]:

IndexField NameData TypeDescription
[0]timestampStringTimestamp of the candle interval with timezone offset (e.g. 2025-01-01T09:15:00+0530).
[1]openFloat / NumberOpening price for the candle interval.
[2]highFloat / NumberHighest price recorded during the candle interval.
[3]lowFloat / NumberLowest price recorded during the candle interval.
[4]closeFloat / NumberClosing price of the candle interval.
[5]volumeIntegerTotal traded volume (contracts/shares) during the candle interval.
[6]open_interestIntegerOpen Interest (OI) at the end of the candle interval.

Response Parameters

KeyData TypeDescription
statusStringStatus of the API request (success or error).
dataObjectResponse container object holding the candles array.
candlesArrayChronologically ordered array of candlestick records.

Required Parameters

ParameterTypeRequiredDescription
symbolString✅Trading symbol (e.g. NIFTY, BANKNIFTY)
product_typeString✅futures or options
typeStringRequired for OptionsCE (Call) or PE (Put)
expiry_dateDate✅Contract expiry date
strike_priceNumberRequired for OptionsStrike price for options contracts
intervalString✅Candle interval
from_dateDateTime✅Start date and time
to_dateDateTime✅End date and time

!!! note

The `strike_price` and `type` fields are **required only** when `product_type` is `options`. They are **not required** for `futures`.

Next Steps

  • Read the Authentication guide.
  • Explore the Historical Data API Reference.
  • Learn about the Export API for large historical data requests.
  • Review the Error Codes and Troubleshooting sections.

Check Export Status

Retrieve the current status of an asynchronous export job. Once the export is complete, the API returns a pre-signed download URL for the generated CSV file.

Endpoint

GET /api/data/v1/status/:job_id

Path Parameters

ParameterTypeRequiredDescription
job_idUUIDYesThe unique identifier returned when the export job was created.

Example Request

curl --request GET \
  --url https://algo.pocketful.in/api/data/v1/status/9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d \
  --header "Authorization: Bearer YOUR_API_TOKEN"

Response (Processing)

{
  "status": "success",
  "job": {
    "job_id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
    "status": "processing",
    "request": {
      "...": "..."
    },
    "created_at": "2026-06-29T09:49:10Z"
  }
}

Response (Completed)

{
  "status": "success",
  "job": {
    "job_id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
    "status": "completed",
    "request": {
      "...": "..."
    },
    "file_url": "https://pktl-market-data.s3.ap-south-1.amazonaws.com/exports/9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d.csv?...",
    "created_at": "2026-06-29T09:49:10Z",
    "completed_at": "2026-06-29T09:49:15Z"
  }
}

!!! success “Export Completed”

When the job status becomes **`completed`**, the `file_url` field contains a pre-signed Amazon S3 URL that can be used to download the exported CSV file.

- The URL is valid for **24 hours**.
- Download the file directly using any browser or HTTP client.
- No additional authentication is required while the pre-signed URL is valid.

Possible Job Statuses

StatusDescription
processingThe export job is currently running.
completedThe export has finished successfully and the download URL is available.
failedThe export could not be completed. Check the error message and retry if necessary.

!!! tip

For large historical data requests, poll this endpoint periodically (for example, every **5–10 seconds**) until the job status changes to **`completed`**.