Doc Fundamentals
Funds Management
Order Management
Portfolio Management
User Authentication
Historical Candles
Daily API Calls
Success Rate
Avg. Response Time
Purpose of the API: To provide historical candle data for various scrip codes for the purpose of strategy deployment.
Authentication: Requires clients to log in, and upon successful login, a token is generated in the response. This token needs to be validated using a JWT validation API.
Data Provided:
- OHLC Data: Open, high, low, and close rates.
- Volume Data: Information about the trading volume.
- Timestamps: Time information associated with the provided data.
Interval Size:
- Maximum Permissible Interval Size: 6 months.
- Day Wise Data: No restrictions on the size of the interval; maximum data can be fetched when the interval is a day.
Supported Intervals:
- 1 minute
- 5 minutes
- 10 minutes
- 15 minutes
- 30 minutes
- 60 minutes
- Day-based interval
Note: The API allows fetching data for any time duration within the specified interval limits.
https://openapi.5paisa.com/V2/historical/N/C/1630/1d?from={FromDate}&end={EndDate}
Headers
KEY | VALUE |
---|---|
x-clientcode | 5paisa client code of the user. |
x-auth-token | JWT token received in the response of login.It should be passed after validating it with the JWT Validation API. |
Ocp-Apim-Subscription-Key | Received along with API credentials |
URL Parameters
FIELD NAME | MANDATORY | DESCRIPTION |
---|---|---|
ExchSTRING | Yes | This indicates the exchange name of the instrument.N: NSE |
ExchTypeSTRING | Yes | It specifies the exchange segment of the instrument.c: Cash |
ScripCodeSTRING | Yes | This is the unique numerical code defined for the instrument.It can be fetched from the scripmaster. |
IntervalSTRING | Yes | Interval range for the candles.1m: 1 minute |
FromDateDATETIME | Yes | Date from which candle data needs to be fetched (Format: YYYY-MM-DD) |
EndDateDATETIME | Yes | Date to which candle data needs to be fetched (Format: YYYY-MM-DD) |
curl --location 'https://openapi.5paisa.com/V2/historical/N/C/1630/1d?from=2023-02-23&end=2023-04-23' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjUwMDUyNzcwIiwicm9sZSI6IjEwMzQ1IiwiU3RhdGUiOiIiLCJSZWRpcmVjdFNlcnZlciI6IkEiLCJuYmYiOjE3MDU1MDE1NjUsImV4cCI6MTcwNTUxNjE5OSwiaWF0IjoxNzA1NTAxNTY1fQ.4Tr9txu_Wowf-AXmTD2yAm98d3TZl5KgKFOFEE6EMco' \
--header 'Cookie: 5paisacookie=ysri4csgzdpr0vqhr45qq4gk' \
--data ''
Response body
FIELD NAME | VALUES | DESCRIPTION | |
---|---|---|---|
statusSTRING | success | This is the status description of the API call. | |
data | candlesARRAY | It provides open, high, close and low rates along with the timestamp for each candle in an array. |
candles
FIELD NAME | VALUES | DESCRIPTION |
---|---|---|
TimestampDATETIME | - | This is the timestamp of the candle in the format of YYYY-MM-DDTHH:MM:SS |
OpenDOUBLE | -
| This is the open rate at given time stamp of the candle |
HighDOUBLE | - | This is the high rate at given time stamp of the candle |
LowDOUBLE | - | This is the low rate at given time stamp of the candle |
CloseDOUBLE | - | This is the close rate at given time stamp of the candle |
VolumeINTEGER | - | This is the volume at given time stamp of the candle |
{
"status": "success",
"data": {
"candles": [
[
"2022-07-15T00:00:00",
292.0,
294.0,
289.5,
293.55,
11025420
],
[
"2022-07-18T00:00:00",
295.0,
296.3,
293.75,
295.3,
11315876
],
[
"2022-07-19T09:15:00",
295.2,
295.6,
292.7,
294.45,
9149737
]
]
}
}
{
"head": {
"ResponseCode": "RPOpenAPI",
"Status": 1,
"Status_description": "Error While Processing"
},
"body": null
}