Historical Data
This API gives you historical candle data for the desired scrip across segments & exchange. This data is presented in the form of a candle and gives you timestamp, open, high, low, close (OHLC) & volume.
dhanhq._historical_data
This API gives you historical candle data for the desired scrip across segments & exchange. This data is presented in the form of a candle and gives you timestamp, open, high, low, close (OHLC) & volume.
Classes
HistoricalData
HistoricalData(dhan_context)
Functions
historical_daily_data
historical_daily_data(security_id, exchange_segment, instrument_type, from_date, to_date, expiry_code=0)
Retrieve OHLC & Volume of daily candle for desired instrument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
security_id |
str
|
Security ID of the instrument. |
required |
exchange_segment |
str
|
The exchange segment (e.g., NSE, BSE). |
required |
instrument_type |
str
|
The type of instrument (e.g., stock, option). |
required |
expiry_code |
str
|
The expiry code for derivatives. |
0
|
from_date |
str
|
The start date for the historical data. |
required |
to_date |
str
|
The end date for the historical data. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
The response containing historical daily data. |
intraday_minute_data
intraday_minute_data(security_id, exchange_segment, instrument_type, from_date, to_date, interval=1)
Retrieve OHLC & Volume of minute candles for desired instrument for last 5 trading day.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
security_id |
str
|
The ID of the security. |
required |
exchange_segment |
str
|
The exchange segment (e.g., NSE, BSE). |
required |
instrument_type |
str
|
The type of instrument (e.g., stock, option). |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
The response containing intraday minute data. |