Intraday Candle Data V3โ
This API is an extended version of standard Intraday Candle Data API, which allows you to retrieve Open, High, Low, and Close (OHLC) values for the current trading day. It supports customizable time intervals across various units such as minutes
, hours
, days
.
This API is particularly useful for traders and analysts who require detailed intraday data for technical analysis, backtesting, or algorithmic trading strategies. This V3 API provides additional custom interval options that are not available in the standard Intraday Candle Data API.
This API provides the following unit and interval options for intraday data:
Unit | Interval Options |
---|---|
minutes | 1, 2, 3, ... 300 |
hours | 1, 2, ... 5 |
days | 1 |
Requestโ
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/1' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
Additional samples in various languages are available in the Sample Code section on this page.
Path Parametersโ
Name | Required | Type | Description |
---|---|---|---|
instrument_key | true | string | The unique identifier for the financial instrument for which historical data is being queried. For the regex pattern applicable to this field, see the Field Pattern Appendix. |
unit | true | string | Specifies the unit for the candles. Possible values: minutes , hours , days . |
interval | true | string | Specifies the interval for the candles. Possible values: 1 , 2 , 3 , ..., 300 for minutes. 1 , 2 , ..., 5 for hours. 1 for days. |
Responses
- 200
- 4XX
Response Bodyโ
Name | Type | Description |
---|---|---|
status | string | A string indicating the outcome of the request. Typically success for successful operations. |
data | object | Contains OHLC values for all instruments across various timeframes. |
data.candles | array[] | Array of candle data, each presented as an array with sequential elements representing trading activity. |
data.candle[0] | number | Timestamp : Indicating the start time of the candle's timeframe. |
data.candle[1] | number | Open : The opening price of the asset for the given timeframe. |
data.candle[2] | number | High : The highest price at which the asset traded during the timeframe. |
data.candle[3] | number | Low : The lowest price at which the asset traded during the timeframe. |
data.candle[4] | number | Close : The closing price of the asset for the given timeframe. |
data.candle[5] | number | Volume : The total amount of the asset that was traded during the timeframe. |
data.candle[6] | number | Open Interest : The total number of outstanding derivative contracts, such as options or futures. |
Error codesโ
Error code | Description |
---|---|
UDAPI1021 | Instrument key is of invalid format - The provided instrument key doesn't conform to the expected format. |
UDAPI100011 | Invalid Instrument key - The instrument key you provided doesn't match any of the recognized keys in the system. |
UDAPI1146 | Invalid unit - The unit you provided is not recognized. Valid options are minutes , hours , days , weeks , or months . |
UDAPI1147 | Invalid interval - The interval you provided is not valid for the specified unit. For example, if the unit is minutes , valid intervals are 1 to 300 . |
Sample Codeโ
Get data with a 1-minute intervalโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/1' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/1';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/1";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/1';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "minutes", "1")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", "1", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", 1);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Get data with a 3-minute intervalโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/3' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/3'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/3';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/3";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/3';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "minutes", "3")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", "3", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", 3);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Get data with a 5-minute intervalโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/5' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/5'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/5';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/5";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/5';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "minutes", "5")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", "5", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", 5);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Get data with a 15-minute intervalโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/15' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/15'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/15';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/15";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/15';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "minutes", "15")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", "15", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", 15);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Get data with a 30-minute intervalโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/30' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/30'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/30';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/30";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/minutes/30';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "minutes", "30")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", "30", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "minutes", 30);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Get data with a 1-hour intervalโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/1' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/1';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/1";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/1';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "hours", "1")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "hours", "1", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "hours", 1);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Get data with a 2-hour intervalโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/2' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/2'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/2';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/2";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/hours/2';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "hours", "2")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "hours", "2", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "hours", 2);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Get current day dataโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/days/1' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/days/1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
const axios = require('axios');
const url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/days/1';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
// Do something with the response data (e.g., print it)
console.log(response.data);
})
.catch(error => {
// Print an error message if the request was not successful
console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
String url = "https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/days/1";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
try {
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
// Check the response status
if (httpResponse.statusCode() == 200) {
// Do something with the response body (e.g., print it)
System.out.println(httpResponse.body());
} else {
// Print an error message if the request was not successful
System.err.println("Error: " + httpResponse.statusCode() + " - " + httpResponse.body());
}
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v3/historical-candle/intraday/NSE_EQ%7CINE848E01016/days/1';
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer {your_access_token}\r\n",
'method' => 'GET',
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
// Check for errors
if ($response === FALSE) {
echo 'Error fetching data';
} else {
// Do something with the response (e.g., print it)
echo $response;
}
?>
import upstox_client
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
api_instance = upstox_client.HistoryV3Api(upstox_client.ApiClient(configuration))
try:
response = api_instance.get_intra_day_candle_data("NSE_EQ|INE848E01016", "days", "1")
print(response)
except Exception as e:
print("Exception when calling HistoryV3Api->get_intra_day_candle_data: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
const historicalApiInstance = new UpstoxClient.HistoryV3Api();
historicalApiInstance.getIntraDayCandleData("NSE_EQ|INE848E01016", "days", "1", (error, data, response) => {
if (error) {
console.error(error.response.text);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
HistoryV3Api historyV3Api = new HistoryV3Api();
try {
GetIntraDayCandleResponse result = historyV3Api.getIntraDayCandleData("NSE_EQ|INE848E01016", "days", 1);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryV3Api->getIntraDayCandleData");
e.printStackTrace();
}
}
}
Loading...