Hi @Dhan @Dhan_Auto_Moderator
When i get the historical_daily_data for one day, it is giving same value of OHLC.
Can you please check
historical_data = dhan.historical_daily_data(
security_id=‘57008’, # NIFTY 09 JUN 22950 CALL
exchange_segment=dhan.FNO,
instrument_type=‘OPTIDX’,
from_date=‘2026-05-25’,
to_date=‘2026-05-26’,
expiry_code=0
)
# Print the retrieved data
print(‘Historical Data:’)
print(historical_data)
####################
O/p =>
Historical Data:
{‘status’: ‘success’, ‘remarks’: ‘’, ‘data’: {‘open’: [886.85], ‘high’: [886.85], ‘low’: [886.85], ‘close’: [886.85], ‘volume’: [0.0], ‘timestamp’: [1779647400.0]}}
Hi @MukeshM
this may be mostly because NIFTY 09 JUN 22950 CALL is illiquid. Try fetching the data for and liquid contract
Hi @Tradehull_Imran
I have changed to NIFTY 02 JUN 23950 CALL, still it shows same OHLC But in the options chart, it shows movement
########################################
historical_data = dhan.historical_daily_data(
security_id=‘57048’, # NIFTY 02 JUN 23950 CALL
exchange_segment=dhan.FNO,
instrument_type=‘OPTIDX’,
from_date=‘2026-05-25’,
to_date=‘2026-05-26’,
expiry_code=0
)
# Print the retrieved data
print(‘Historical Data:’)
print(historical_data)
########################
Historical Data:
{‘status’: ‘success’, ‘remarks’: ‘’, ‘data’: {‘open’: [160.35], ‘high’: [160.35], ‘low’: [160.35], ‘close’: [160.35], ‘volume’: [0.0], ‘timestamp’: [1779647400.0]}}
Hi @MukeshM
yes we have also observed the same with historical api call on daily timeframe.
raising it with @Dhan team for same.
till then we can call 5 mins timeframe data, and get previous day ohlc value.
below is the code for same
from Dhan_Tradehull import Tradehull
import time
import pdb
import datetime
client_code = ""
pin = ""
totp_secret = ""
tsl = Tradehull(ClientCode=client_code, mode="pin_totp", pin=pin, totp_secret=totp_secret)
name = 'NIFTY 02 JUN 24000 CALL'
day = tsl.get_historical_data(tradingsymbol=name, exchange='NFO', timeframe="DAY")
previous_trading_date = day.iloc[-1]['timestamp']
previous_day_start = str(previous_trading_date) + ' 09:15:00+05:30'
previous_day_end = str(previous_trading_date) + ' 15:25:00+05:30'
min_5_data = tsl.get_historical_data(tradingsymbol=name, exchange='NFO', timeframe="5")
min_5_data = min_5_data.set_index('timestamp')
prev_trading_df = min_5_data[previous_day_start:previous_day_end]
openx = prev_trading_df.iloc[0]['open']
high = prev_trading_df['high'].max()
low = prev_trading_df['low'].min()
close = prev_trading_df.iloc[-1]['close']
print(name, openx, high, low, close)
we have used Dhan Tradehull codebase for api calls
refer the documentation for codebase here
Thanks @Tradehull_Imran
What I have observed that the api is not consistently returns the day data like it is returning data 2026-05-27 but not for 2026-05-26 and 2026-05-25 and replaces the previous day close value if current day volume is 0 which shouldn’t happen.
Lets say if i am working on 2026-05-26, then i didn’t get the correct data 2026-05-25
##################
Initialize Tradehull client
tsl = Tradehull(dhan_client_code, dhan_access_token)
name = ‘NIFTY 02 JUN 23950 CALL’ # ‘NIFTY 02 JUN 24000 CALL’
day = tsl.get_historical_data(tradingsymbol=name, exchange=‘NFO’, timeframe=“DAY”)
print(day)
#########################
open high low close volume timestamp
0 461.00 469.50 379.30 389.35 22620.0 2026-05-11
1 389.35 389.35 389.35 389.35 0.0 2026-05-12
2 214.05 305.00 192.05 264.85 16315.0 2026-05-14
3 264.85 264.85 264.85 264.85 0.0 2026-05-15
4 264.85 264.85 264.85 264.85 0.0 2026-05-19
5 264.85 264.85 264.85 264.85 0.0 2026-05-20
6 264.85 264.85 264.85 264.85 0.0 2026-05-21
7 165.40 206.90 140.95 160.35 584675.0 2026-05-22
8 160.35 160.35 160.35 160.35 0.0 2026-05-25
9 160.35 160.35 160.35 160.35 0.0 2026-05-26
10 180.00 193.60 120.65 154.65 95864405.0 2026-05-27
yes, its happening like that