@Leelamrutha_G_J
Also remove dependencies folder, and use a new access token in the code as well
dependencies folder
@Leelamrutha_G_J
Also remove dependencies folder, and use a new access token in the code as well
Hi @Tradehull_Imran ,Still facing same issue .can you please help
C:\Users\darsh\PycharmProjects\PythonProject.venv\Scripts\python.exe C:\Users\darsh\PycharmProjects\PythonProject\main.py
Mibian requires scipy to work properly
Codebase Version 3.3.1
Attempting authentication using ACCESS TOKEN.
Input access token profile validated successfully
Token validity: 11/06/2026 10:39
System is fetching the latest instrument file from Dhan
Instrument file retrieved successfully
-----SUCCESSFULLY LOGGED INTO DHAN-----
Exception at getting Expiry list as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: None, ‘error_type’: None, ‘error_message’: None}, ‘data’: ‘’}
Unable to find the correct Expiry for NIFTY
Traceback (most recent call last):
File “C:\Users\darsh\PycharmProjects\PythonProject\main.py”, line 7, in
CE_symbol_name, PE_symbol_name, strike = tsl.ATM_Strike_Selection(Underlying=‘NIFTY’, Expiry=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object
Process finished with exit code 1
Hi @Leelamrutha_G_J ,
Once again, remove the Dependencies folder and update the code with a newly generated access token.
Refer the code -
from Dhan_Tradehull import Tradehull
client_code = ""
access_token = ''
tsl = Tradehull(client_code, access_token, mode="access_token")
ce,pe,strike = tsl.ATM_Strike_Selection('NIFTY',0)
print(ce,pe,strike)
Output -
Hi @Tradehull_Imran ,Still facing same issue .
Hi @Leelamrutha_G_J ,
To access the data, an active Data subscription from Dhan is required. Kindly verify your subscription status once.
from Dhan_Tradehull import Tradehull
from rich import print
import datetime
client_code = “__”
pin = “__”
totp_secret = “_____” (ye 3no chize yaha ke liye nikaldi he. varna proper he. windows me login ho jata he sirf cloud server me nhi ho rha.)
tsl = Tradehull(ClientCode=client_code, mode=“pin_totp”, pin=pin, totp_secret=totp_secret)
for x in range(1):
current_time = datetime.datetime.now()
orderid = tsl.order_placement(tradingsymbol='WIPRO', exchange='NSE', quantity=1, price=192, trigger_price=0,order_type='LIMIT', transaction_type='BUY', trade_type='MIS')#, after_market_order = True, amo_time = 'OPEN')
print(f"Order placed {current_time} {orderid}")
me sirf ye video ka 1st algo try kar rha tha. abhi sikh rha hu. (**Master Algo Trading with Python | Episode 6: First Live Algo | Algo Trading FREE Course)
FYI: pehle 4 gb ka droplet liya to blank screen aa rhi thi then 6 gb ka upgrade kiya**
root@ubuntu-s-1vcpu-512mb-10gb-blr1-Dhierav1:~/Desktop/Installation# python3 Order_testing.py
Mibian requires scipy to work properly
Codebase Version 3.3.1
Attempting authentication using PIN + TOTP.
Cached token profile validated successfully
Token validity: 12/06/2026 07:31
System is fetching the latest instrument file from Dhan
Already logged in for today, so reusing the validated token
Instrument file retrieved successfully
-----SUCCESSFULLY LOGGED INTO DHAN-----
'Got exception in place_order as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-905’, ‘error_type’: ‘Input_Exception’, ‘error_message’: ‘Invalid IP’}, ‘data’: ‘’}
Order placed 2026-06-11 08:19:27.445857 None
root@ubuntu-s-1vcpu-512mb-10gb-blr1-Dhierav1:~/Desktop/Installation#
reserved ip bhi proper he mene check kiya.
Hi @DHIERAV_SSOLANKI ,
Check whether the Public IPv4 address has been added correctly in the Dhan static IP settings. If it has been configured correctly, restart the server once and try again.
Refer to the following video for static IP-related issues -
Hi @DHIERAV_SSOLANKI
IP address has been added correctly in the Dhan static IP settings. Ideally now the order placement shall not give any static IP error.
was the order placed in Dhan account. if now, allow us sometime, we are checking on it
Done. ho gya. mene install.sh ko open karke install nhi kiya tha.
abhi sab try kar rha tha to vo open karke install kiya. order place ho gya. mera first order with algo successfully ho gya.
Hi @DHIERAV_SSOLANKI
It’s done .. we are happy for you ![]()
FYI
Master Algo Trading with Python | Episode 7: Python Basics (Part 3) | FREE Algo Trading Masterclass
ye timer pe 17:40 speed ki baat ki thi
import time
from datetime import datetime
num = 0
count = 0
start = time.time()
while True:
num += 1
count += 1
elapsed = time.time() - start
if elapsed >= 1.0:
current_time = datetime.now().strftime("%H:%M:%S")
print(f"Time: {current_time} | Numbers per second: {count}")
count = 0
start = time.time()
if num == 10_000_000:
break
E:\google drive dhierav\My Drive\PY\7. Session7- Python Basics Part 3>py “counter 1.py”
Time: 22:13:41 | Numbers per second: 2432785
Time: 22:13:42 | Numbers per second: 1247440
Time: 22:13:43 | Numbers per second: 1535310
Time: 22:13:44 | Numbers per second: 2449977
Time: 22:13:45 | Numbers per second: 1059044
ye mere laptop me speed he
iski speed 12k per secound nhi usse bhi jyada he.
C language me to according to claude
Python is relatively slow for this kind of tight loop; for comparison, the same loop in C would do 500M–1B+ per second on the same hardware
you can also try this code.
but it has a huge impact on your cpu chip and ram unless u have the highest capacity installed on your pc not good for retailer who are not tech savy
I developed my own framework for algos by following your videos and understanding concepts. This downloads required historical data, indicator calculation, backtesting, order placement etc
Now I am stuck at building strategies. I tried to build various strategies explained on Dhan platform but none of them are giving me good backtest results.
How should I approach strategy development? Which strategy should I start and how can I optimise it so that it is ready for live deployment.
Thanks!
I think the best way to approach strategy building is to learn from hedge fund managers themselves.
Also there are some concepets which are stratgies in itself.
Here are some concepts and their associated books, by hedge fund managers
1. Volatality : Volatility Trading by Euan Sinclair
2. Stastical arbitrage : Quantitative Trading How to Build Your Own Algorithmic Trading Business By Ernest P. Chan · 2021
3. Probablity : A Man for All Markets: From Las Vegas to Wall Street, How I Beat the Dealer and the Market
4. Options Greeks : Trading Options Greeks: How Time, Volatility, and Other Pricing Factors Drive Profits by Dan Passarelli (Author)
Thank you so much sir for directing me.