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?
