Learn Algo Trading with Python | Codes | Youtube Series

Hi @kanhaji ,

Yes you need to subscribe to data api to fetch live data or historical data.

Hi @SITA_RAM ,

  • Open Command Prompt: Press Win, type cmd, and press Enter.
  • Install Dhan-Tradehull: Run pip install Dhan-Tradehull
  • Confirm the installation by running pip show Dhan-Tradehull

Thank you once again @Tradehull_Imran sir.

Very Good Afternoon Sir, I have enough money in my Dhan Account. But not able to Subscribe for Dhan API.
It is generating token but, its showing the following error sir.

C:\Users\LENOVO PC\Desktop\RP\Dhan Algo\DHAN Advanced Algo Trading Series\Session 9\Session 9\Dhan Option Chain\Dhan Option Chain>py "1. Download_Historical_data.py"
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-29.csv
Got the instrument file
Exception in Getting OHLC data as {'status': 'failure', 'remarks': {'error_code': 'DH-902', 'error_type': 'Invalid_Access', 'error_message': 'HTTP Status 451. User has not subscribed to Data APIs or does not have access to Trading APIs. Kindly subscribe to Data APIs to be able to fetch Data.'}, 'data': {'errorType': 'Invalid_Access', 'errorCode': 'DH-902', 'errorMessage': 'HTTP Status 451. User has not subscribed to Data APIs or does not have access to Trading APIs. Kindly subscribe to Data APIs to be able to fetch Data.'}}
Traceback (most recent call last):
  File "1. Download_Historical_data.py", line 31, in <module>
    ATM_time_data = index_data[index_data['timestamp']==start_time]
TypeError: 'NoneType' object is not subscriptable

[
106xauto

148xauto
](‎Dhan: Share Market Trading App on the App Store)

120xauto

DhanHQ Data APIs Subscription Successful

Dear Babu,

You have successfully subscribed to DhanHQ Data APIs. You can now access real-time market feed across segments along with historical data too.

Your subscription will be auto-renewed every 30 days. You can check and modify subscription plan from Dhan Web.

If you need help, feel free to reach out to our team by writing to

help@dhan.co we’re always available to assist you!

I am not able to understand, why the error is showing like that sir?
VBR Prasad

Subscription Completed, now getting th same old error. I have downloaded the Dhan_Tradehull_V2 file in this folder and tried. StarT_Date is not available in Dhan_Tradehull file. But it’s available only in Dhan_tradehull_V2 file. This si the reason , I got this file in my Current Folder of Session-9 of Advanced Series sir. Still Getting the same error.

C:\Users\LENOVO PC\Desktop\RP\Dhan Algo\DHAN Advanced Algo Trading Series\Session 9\Session 9\Dhan Option Chain\Dhan Option Chain>py "1. Download_Historical_data.py"
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-29.csv
Got the instrument file
Traceback (most recent call last):
  File "1. Download_Historical_data.py", line 38, in <module>
    ATM_Strike = round(ATM_close/step)*step
NameError: name 'ATM_close' is not defined

@Tradehull_Imran @Dhan @RahulDeshpande

Hi everyone,

Is there a plan to teach us how to backtest our strategy?

Please create a few videos so we can determine which approach works best for which instrument and when.

Thanks