I am facing difficulty in placing simple order can any help me with this?

import time

from Dhan_Tradehull import Tradehull

client_code = “”

totp_secret = “”

pin = “”

print(“Connecting…”)

try:

tsl = Tradehull(

ClientCode=client_code,

mode=“pin_totp”,

pin=pin,

totp_secret=totp_secret

)

print(“Login successful”)

except Exception as e:

print(“Login failed:”, e)

raise

symbol = “HDFCBANK”

qty = 1

side = “BUY”

print(f"Testing order placement for {symbol}")

try:

entry_orderid = tsl.order_placement(

tradingsymbol=symbol,

exchange=“NSE”,

quantity=qty,

price=0,

trigger_price=0,

order_type=“MARKET”,

transaction_type=side,

trade_type=“MIS”

)

print(“Entry order id:”, entry_orderid)

except Exception as e:

print(“Entry order failed:”, e)

raise

Error message:

-----SUCCESSFULLY LOGGED INTO DHAN-----
Login successful
Testing order placement for HDFCBANK
'Got exception in place_order as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-905’, ‘error_type’: ‘Input_Exception’, ‘error_message’: ‘Invalid IP’}, ‘data’: ‘’}
Entry order id: None
((.venv) ) satya@Satyadevs-MacBook-Air Algo_setup %

can anyone help me with this?

Hi @Satyadev_Verma ,

The issue is due to Invalid Static IP .

Refer this video regarding the Static IP -

1 Like

नमस्ते टीम,

Dhan API में daily historical data को लेकर issue आ रहा है।

Index (NSE_I) का daily historical data सही मिल रहा है, लेकिन option instruments (NSE_D OPTIDX NSE_FNO) में daily candle का OHLC गलत/invalid आ रहा है। उदाहरण के लिए candle में open/high/low/close सभी same value दिख रही हैं और volume भी 0 आ रहा है, जबकि उसी instrument token का intraday candle data बिल्कुल सही मिल रहा है।

यह issue कुछ दिन पहले भी आया था, तब लगा शायद temporary glitch होगा, लेकिन अभी फिर से same problem आ रही है।

कृपया check करें कि option contracts के daily historical API data में कोई backend issue तो नहीं है।
अगर कोई parameter/change required है तो please guide करें।

धन्यवाद। 13 NSE_I INDEX IDX_I
open high low close volume timestamp
0 24398.5 24482.1 24284.0 24326.65 440621691.0 1.778092e+09
24326.65
41762 NSE_D OPTIDX NSE_FNO
open high low close volume timestamp
0 151.05 151.05 151.05 151.05 0.0 1.778092e+09
151.05
41779 NSE_D OPTIDX NSE_FNO
open high low close volume timestamp
0 333.65 333.65 333.65 333.65 0.0 1.778092e+09
333.65
(new_app) PS C:\A-WORK\new_app> NSE,D,41762,NA,OPTIDX,26000,NIFTY,NIFTY-May2026-24200-CE,NIFTY 12 MAY 24200 CALL,OP,NA,65.0,2026-05-12,24200.00000,CE,5.0000,W,N,N,N,NA,A,0,0,0,0,0,0,0,558.0000,0.0500, token 41762

Hi @sumit_kumar5
you can try with tradehull codebase, its a wrapper on the top of dhanhq api

here we were able to fetch daily historical data for options

for codebase usage see this video

Hi Team,
Thanks for checking.

But the issue is still visible in the screenshot shared by you as well.

In the returned DAILY candles for option contracts, multiple dates (for example 2026-05-06 and 2026-05-07 in the screenshot) are showing:

  • Open = High = Low = Close

  • Volume = 0

  • Open Interest unchanged

This is not the actual market candle data for those option contracts.

Intraday historical data for the same instrument is coming correctly, only DAILY timeframe data seems incorrect for some option contracts .

So the concern is not about using Tradehull wrapper vs direct API — the underlying daily data itself appears inconsistent.

Could you please verify the backend historical source for option DAILY candles?

Thanks.

Hi @sumit_kumar5

We agree with the observation.
we will check on it

any solution ?

Thanks @Tradehull_Imran

1 Like