Skip to content

Historical candle data

GET /history/candleData

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

Parameters

NameTypeRequiredDescription
exchangestringfalseName of the exchange. Valid values are (BSE/ NSE/ NFO/ MCX/ CDS). Default is NSE if not provided.
symbolNamestringtrueSymbol name of the scrip.
fromDatestringtrueStart date in yyyy-MM-dd format.
toDatestringfalseEnd date in yyyy-MM-dd format. If not provided, data is fetched only for the fromDate.

Sample Code

bash
curl -X GET 'https://tradeapi.samco.in/history/candleData?symbolName=INFY&fromDate=2019-10-11' \
  -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/candleData?symbolName=INFY&fromDate=2019-10-11"))
        .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/candleData?symbolName=INFY&fromDate=2019-10-11', {
    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/candleData?symbolName=INFY&fromDate=2019-10-11',
  headers=headers)

print(r.json())

Sample Responses

json
{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "historicalCandleData": [
    {
      "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. Quote this to the support team if needed.
statusstringResponse status. Can be Success or Failure.
statusMessagestringStatus message of the response.
historicalCandleData[object]List of historical candle 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.
volumestringAmount of security traded on the specific day.