Skip to content

Index Historical CandleData

GET /history/indexCandleData

Gets the Index historical candle data such as Open, high, low, close, last traded price and volume within specific dates for a specific index. From date is mandatory. End date is optional and defaults to Today.

Supported Index names:

BSE CGSENSEXBSE CDNIFTY50 PR 1x INV
BSE ITMETALOILGASNIFTY50 PR 2x LEV
BSEIPOGREENXPOWERNIFTY50 TR 1x INV
CARBONBASMTRCDGSNIFTY50 TR 2x LEV
BSEFMCBSE HCALLCAPNIFTY50 TR 2x LEV
REALTYSMEIPODOL30NIFTY Mid LIQ 15
LRGCAPMIDSELSMLSELNIFTY100 LIQ 15
SNXT50SNSX50NIFTY 50NIFTY Quality 30
NIFTY BANKNIFTY NEXT 50DOL100NIFTY MIDCAP 50
NIFTY 100NIFTY 200NIFTY 500NIFTY FIN SERVICE
NIFTY AUTONIFTY FMCGNIFTY ITNIFTY COMMODITIES
NIFTY MEDIANIFTY METALNIFTY PHARMANIFTY CONSUMPTION
NIFTY PSU BANKNIFTY PVT BANKNIFTY REALTYNIFTY GROWSECT 15
NIFTY CPSENIFTY ENERGYNIFTY INFRANIFTY DIV OPPS 50
NIFTY MNCNIFTY PSENIFTY SERV SECTORNIFTY MID100 FREE
DOL200TECKBSEPSUNIFTY SML100 FREE
AUTOBANKEXINDIA VIXNIFTY50 VALUE 20
NIFTY MID SELECT

Parameters

NameTypeRequiredDescription
indexNamestringtrueIndex name of the scrip.
fromDatestringtrueFrom date in yyyy-MM-dd.
toDatestringfalseTo date in yyyy-MM-dd.

Code Sample

bash
curl -X GET 'https://tradeapi.samco.in/history/indexCandleData?indexName=SENSEX&fromDate=2020-03-09' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-session-token: <SESSION_TOKEN>'
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Sample {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/history/indexCandleData?indexName=SENSEX&fromDate=2020-03-09"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .header("x-session-token", "<SESSION_TOKEN>")
        .GET()
        .build();

    HttpResponse<String> response =
        client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.body());
  }
}
js
(async () => {
  const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'x-session-token': '<SESSION_TOKEN>',
  };

  const response = await fetch('https://tradeapi.samco.in/history/indexCandleData?indexName=SENSEX&fromDate=2020-03-09', {
    method: 'GET',
    headers,
  });

  const data = await response.json();
  console.log(data);
})();
py
import requests
import json

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': '<SESSION_TOKEN>',
}

r = requests.get('https://tradeapi.samco.in/history/indexCandleData?indexName=SENSEX&fromDate=2020-03-09',
  headers=headers)

print(r.json())

Sample Response

json
{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Index details retrieved successfully.",
  "indexCandleData": [
    {
      "date": "2019-11-01",
      "open": "689.9",
      "high": "694.0",
      "low": "682.75",
      "close": "688.0",
      "ltp": "688.0",
      "volume": "600344"
    }
  ]
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringTime at Server.
msgIdstringUnique identifier for the request. Please quote this to the support team if needed.
statusstringResponse status. Can be success or failure.
statusMessagestringStatus message of the Index request.
indexCandleData[object]List of Index data.
datestringDate for which CandleData is shown.
openstringOpening price of the market snapshot.
highstringHighest value of the market snapshot.
lowstringLowest value of the market snapshot.
closestringClosing price of the market snapshot.
ltpstringLast traded price.
volumestringLimit amount of a security traded on the specific day.