Hi Raja,
Yes I understand from error but this function is from Dhan_Tradehull.py file and this is part of dhan package..
@Tradehull_Imran Sir
गुरु के चरणों में प्रणाम ।
SQN वैल्यू को मजबूत कहा जा सकता है, कृपया मार्ग दर्शन करें ।
@Tradehull_Imran sir, my code worked after following your instructions for re-installation. TAL. We’ll keep interacting here.
Hi @Manish_M ,
Kindly upgrade the codebase version you have been using, refer the below thread-
Dhan_Tradehull Library Update: Python 3.12 & Authentication Improvements - APIs, Automation, Algos & Code - MadeForTrade
Hi @vinay_kumaar ,
The SQN value of 5.72 falls under the “Holy Grail” category. If the backtesting data and assumptions are accurate, this represents a significant achievement.
Additionally, please confirm whether brokerage charges and slippage have been included in the backtesting calculations. If they have not been factored in, kindly incorporate them and recalculate the SQN accordingly.
Hi @Tradehull_Imran Sir,
I followed the above link but still getting below error-
From this page - Dhan-Tradehull · PyPI
I am not able to find requirement.txt file so not able to execute this command-
pip install -r requirement.txt
/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/bin/python /Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_codebase usage.py
Mibian requires scipy to work properly
-----Logged into Dhan-----
This BOT Is Picking New File From Dhan
Got the instrument file
dhanhq.intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 258, in get_intraday_data
ohlc = self.Dhan.intraday_minute_data(str(security_id), exchangeSegment, instrument_type)
TypeError: dhanhq.intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 258, in get_intraday_data
ohlc = self.Dhan.intraday_minute_data(str(security_id), exchangeSegment, instrument_type)
TypeError: dhanhq.intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
dhanhq.intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
DataFrame constructor not properly called!
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 224, in get_historical_data
df = pd.DataFrame(ohlc[‘data’])
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/frame.py”, line 869, in init
raise ValueError(“DataFrame constructor not properly called!”)
ValueError: DataFrame constructor not properly called!
dhanhq.intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 258, in get_intraday_data
ohlc = self.Dhan.intraday_minute_data(str(security_id), exchangeSegment, instrument_type)
TypeError: dhanhq.intraday_minute_data() missing 2 required positional arguments: ‘from_date’ and ‘to_date’
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 399, in ATM_Strike_Selection
closest_index = ce_df[‘diff’].idxmin()
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/series.py”, line 2484, in idxmin
iloc = self.argmin(axis, skipna, *args, **kwargs)
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/base.py”, line 887, in argmin
result = nanops.nanargmin(delegate, skipna=skipna)
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/nanops.py”, line 1201, in nanargmin
result = values.argmin(axis)
ValueError: attempt to get argmin of an empty sequence
— Logging error —
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 399, in ATM_Strike_Selection
closest_index = ce_df[‘diff’].idxmin()
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/series.py”, line 2484, in idxmin
iloc = self.argmin(axis, skipna, *args, **kwargs)
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/base.py”, line 887, in argmin
result = nanops.nanargmin(delegate, skipna=skipna)
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/nanops.py”, line 1201, in nanargmin
result = values.argmin(axis)
ValueError: attempt to get argmin of an empty sequence
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/logging/init.py”, line 1151, in emit
msg = self.format(record)
File “/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/logging/init.py”, line 999, in format
return fmt.format(record)
~~~~~~~~~~^^^^^^^^
File “/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/logging/init.py”, line 712, in format
record.message = record.getMessage()
~~~~~~~~~~~^^
File “/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/logging/init.py”, line 400, in getMessage
msg = msg % self.args
^
TypeError: not all arguments converted during string formatting
Call stack:
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_codebase usage.py”, line 33, in
ce_name, pe_name, strike = tsl.ATM_Strike_Selection(‘NIFTY’,‘10-02-2026’)
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 426, in ATM_Strike_Selection
self.logger.exception("Got exception in ce_pe_option_df ", e)
Message: 'Got exception in ce_pe_option_df ’
Arguments: (ValueError(‘attempt to get argmin of an empty sequence’),)
exception got in ce_pe_option_df attempt to get argmin of an empty sequence
Getting Error at OTM strike Selection as attempt to get argmin of an empty sequence
Getting Error at OTM strike Selection as attempt to get argmin of an empty sequence
single positional indexer is out-of-bounds
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_Tradehull.py”, line 255, in get_intraday_data
security_id = self.instrument_df[((self.instrument_df[‘SEM_TRADING_SYMBOL’]==tradingsymbol)|(self.instrument_df[‘SEM_CUSTOM_SYMBOL’]==tradingsymbol))&(self.instrument_df[‘SEM_EXM_EXCH_ID’]==instrument_exchange[exchange])].iloc[-1][‘SEM_SMST_SECURITY_ID’]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/indexing.py”, line 1207, in getitem
return self._getitem_axis(maybe_callable, axis=axis)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/indexing.py”, line 1773, in _getitem_axis
self._validate_integer(key, axis)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/.venv/lib/python3.14/site-packages/pandas/core/indexing.py”, line 1706, in _validate_integer
raise IndexError(“single positional indexer is out-of-bounds”)
IndexError: single positional indexer is out-of-bounds
Traceback (most recent call last):
File “/Users/apple/PycharmProjects/PythonProject-Dhan-API/3. Session3 - Codebase1/Dhan codebase/Dhan_codebase usage.py”, line 39, in
intraday_hist_data[‘rsi’] = talib.RSI(intraday_hist_data[‘close’], timeperiod=14)
~~~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: ‘NoneType’ object is not subscriptable
Process finished with exit code 1
Hi @Manish_M ,
• Confirm the version’s for dhanhq and Dhan-Tradehull, run the below commands in cmd terminal and share the screenshot-
where python
pip show dhanhq
pip show Dhan-Tradehull
Hi algo traders!
Great to see the commitment towards learning after watching Imran Sir’s sessions here… To help you get your algo related doubts solved and make this more meaningful, we at Upsurge are organising a FREE live workshop with Imran Sir, which STARTS IN 4 HOURS ![]()
This 5-Day LIVE Algo Trading Workshop will show you how real traders:
- Build strategies
- Backtest properly
- Deploy live algos
- Manage risk like pros
There will be a Q&A for you guys towards the end of the session too ![]()
It’s starting at 8PM today, so make sure you block your time and join in. All details here, enroll now ![]()
Algo Trading Workshop with Imran Ali
Hi @Tradehull_Imran Sir,
Can you please have a look into above screen shot?
i want make algo ,i have strategy ad it works also but i dontknow how to make can you please help me…
Very Good Morning Sir. Just now I have tried running the ‘download data.py’ file provided in recent Multi Timeframe . While running I am getting the following error sir. My access token is correct. I have updated the From Date to match with 5 years limit also.
ERROR is as follows sir:
C:\Users\Admin\Desktop\TRADES\Dhan Algo\11-01-2026-Algo Adv Stratgy\6. Multi Timeframe\Historical Data>py “download data.py”
Codebase Version 3.1.0
-----Logged into Dhan-----
reading existing file all_instrument 2026-02-15.csv
Got the instrument file
Exception: Failed to retrieve DAY timeframe data: {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-905’, ‘error_type’: ‘Input_Exception’, ‘error_message’: ‘Missing required fields, bad values for parameters etc.’}, ‘data’: ‘’}
Please rersolve the issue sir. Thank you.
mujhe sar excel file me deta update nahi ho raha he mujhe help chahi ye imran sar
please sar help chahiye mujhe session 3 me hu meri excel file khul rahi he magar kam nahi kar rahi he kese problam solve ho sakta he
Sir as you can see in the terminal, i am able unable to fetch the data of few stocks
I am really confused as i can fetch data of few other stocks, not able to find out the problem
the time of fething data is 7:30 am , but i dont think so its the problem of time as i am calling historical data
The same thing happened to me in the past too….
Please help
@Tradehull_Imran Sir my code indicators values dffer from the chart indicator values, there is a major difference between them
please suggest a solution
chart = tsl.get_historical_data(tradingsymbol=stock, exchange="NSE", timeframe="5")
chart[‘rsi’] = talib.RSI(chart[‘close’], timeperiod=14)
chart[“upperband”], chart[“middleband”], chart[“lowerband”] = talib.BBANDS(chart[“close”], timeperiod=14, nbdevup=2, nbdevdn=2, matype=0)
Hi algo traders, reminder to continue the learning streak ![]()
Day 2 of the FREE live workshop with Imran Sir, is happening TOMORROW ![]()
This session is all about:
- Selecting the right option strategy
- Backtest it to determine its success rate
- Understanding the basics of how to deploy it
There will be a Q&A for you guys towards the end of the session too ![]()
Make sure you block your time and join in. All details here, enroll now ![]()
Algo Trading Workshop with Imran Ali
Hi @Vijay_Hiren ,
You can create own algo’s. Refer our algo trading series -
You can use our updated codebase -
Hi @Vasili_Prasad ,
Itseems you are using older version of codebase, do update to our latest version codebase where you don’t require to generate access token everyday using totp + pin login, do refer the below link-





