All URIs are relative to https://api-v2.upstox.com
Method | HTTP request | Description |
---|---|---|
getHistoricalCandleData | GET /historical-candle/{instrumentKey}/{interval}/{to_date} | Historical candle data |
getHistoricalCandleData1 | GET /historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date} | Historical candle data |
getIntraDayCandleData | GET /historical-candle/intraday/{instrumentKey}/{interval} | Intra day candle data |
GetHistoricalCandleResponse getHistoricalCandleData(instrumentKey, interval, toDate, apiVersion)
Historical candle data
Get OHLC values for all instruments across various timeframes. Historical data can be fetched for the following durations. 1minute: last 1 month candles till endDate 30minute: last 1 year candles till endDate day: last 1 year candles till endDate week: last 10 year candles till endDate month: last 10 year candles till endDate
// Import classes:
//import com.upstox.ApiException;
//import io.swagger.client.api.HistoryApi;
HistoryApi apiInstance = new HistoryApi();
String instrumentKey = "instrumentKey_example"; // String |
String interval = "interval_example"; // String |
String toDate = "toDate_example"; // String |
String apiVersion = "apiVersion_example"; // String | API Version Header
try {
GetHistoricalCandleResponse result = apiInstance.getHistoricalCandleData(instrumentKey, interval, toDate, apiVersion);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryApi#getHistoricalCandleData");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
instrumentKey | String | ||
interval | String | ||
toDate | String | ||
apiVersion | String | API Version Header |
No authorization required
GetHistoricalCandleResponse getHistoricalCandleData1(instrumentKey, interval, toDate, fromDate, apiVersion)
Historical candle data
Get OHLC values for all instruments across various timeframes. Historical data can be fetched for the following durations. 1minute: last 1 month candles till endDate 30minute: last 1 year candles till endDate day: last 1 year candles till endDate week: last 10 year candles till endDate month: last 10 year candles till endDate
// Import classes:
//import com.upstox.ApiException;
//import io.swagger.client.api.HistoryApi;
HistoryApi apiInstance = new HistoryApi();
String instrumentKey = "instrumentKey_example"; // String |
String interval = "interval_example"; // String |
String toDate = "toDate_example"; // String |
String fromDate = "fromDate_example"; // String |
String apiVersion = "apiVersion_example"; // String | API Version Header
try {
GetHistoricalCandleResponse result = apiInstance.getHistoricalCandleData1(instrumentKey, interval, toDate, fromDate, apiVersion);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryApi#getHistoricalCandleData1");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
instrumentKey | String | ||
interval | String | ||
toDate | String | ||
fromDate | String | ||
apiVersion | String | API Version Header |
No authorization required
GetIntraDayCandleResponse getIntraDayCandleData(instrumentKey, interval, apiVersion)
Intra day candle data
Get OHLC values for all instruments for the present trading day
// Import classes:
//import com.upstox.ApiException;
//import io.swagger.client.api.HistoryApi;
HistoryApi apiInstance = new HistoryApi();
String instrumentKey = "instrumentKey_example"; // String |
String interval = "interval_example"; // String |
String apiVersion = "apiVersion_example"; // String | API Version Header
try {
GetIntraDayCandleResponse result = apiInstance.getIntraDayCandleData(instrumentKey, interval, apiVersion);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling HistoryApi#getIntraDayCandleData");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
instrumentKey | String | ||
interval | String | ||
apiVersion | String | API Version Header |
No authorization required