Skip to content

Latest commit

 

History

History
175 lines (127 loc) · 6.35 KB

HistoryApi.md

File metadata and controls

175 lines (127 loc) · 6.35 KB

Upstox\Client\HistoryApi

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

getHistoricalCandleData

\Upstox\Client\Model\GetHistoricalCandleResponse getHistoricalCandleData($instrument_key, $interval, $to_date, $api_version)

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

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Upstox\Client\Api\HistoryApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$instrument_key = "instrument_key_example"; // string | 
$interval = "interval_example"; // string | 
$to_date = "to_date_example"; // string | 
$api_version = "api_version_example"; // string | API Version Header

try {
    $result = $apiInstance->getHistoricalCandleData($instrument_key, $interval, $to_date, $api_version);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HistoryApi->getHistoricalCandleData: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
instrument_key string
interval string
to_date string
api_version string API Version Header

Return type

\Upstox\Client\Model\GetHistoricalCandleResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getHistoricalCandleData1

\Upstox\Client\Model\GetHistoricalCandleResponse getHistoricalCandleData1($instrument_key, $interval, $to_date, $from_date, $api_version)

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

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Upstox\Client\Api\HistoryApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$instrument_key = "instrument_key_example"; // string | 
$interval = "interval_example"; // string | 
$to_date = "to_date_example"; // string | 
$from_date = "from_date_example"; // string | 
$api_version = "api_version_example"; // string | API Version Header

try {
    $result = $apiInstance->getHistoricalCandleData1($instrument_key, $interval, $to_date, $from_date, $api_version);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HistoryApi->getHistoricalCandleData1: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
instrument_key string
interval string
to_date string
from_date string
api_version string API Version Header

Return type

\Upstox\Client\Model\GetHistoricalCandleResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getIntraDayCandleData

\Upstox\Client\Model\GetIntraDayCandleResponse getIntraDayCandleData($instrument_key, $interval, $api_version)

Intra day candle data

Get OHLC values for all instruments for the present trading day

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Upstox\Client\Api\HistoryApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$instrument_key = "instrument_key_example"; // string | 
$interval = "interval_example"; // string | 
$api_version = "api_version_example"; // string | API Version Header

try {
    $result = $apiInstance->getIntraDayCandleData($instrument_key, $interval, $api_version);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HistoryApi->getIntraDayCandleData: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
instrument_key string
interval string
api_version string API Version Header

Return type

\Upstox\Client\Model\GetIntraDayCandleResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]