Excellent Series @Tradehull_Imran !! Please can you advice if Trade hull library supports Dhan Sandbox API access ? This would allow us to test our strategies before deploying live.
@Tradehull_Imran: Hi Sir, im struggling with placing the BO using the TradeHull Dhan method call. – here is the code i’m using followed by the error im getting –
bo_orderid = tsl.place_slice_order(
tradingsymbol=options_name,
exchange='NFO',
quantity=orderbook[name]['qty'],
transaction_type='BUY',
order_type='MARKET',
trade_type='BO',
price=0,
trigger_price=0,
bo_profit_value=float(target_points),
bo_stop_loss_Value=float(sl_points)
)
'Got exception in place_order as {'status': 'failure', 'remarks': {'error_code': 'DH-906', 'error_type': 'Order_Error', 'error_message': 'Transactions Fails.'}, 'data': {'errorType': 'Order_Error', 'errorCode': 'DH-906', 'errorMessage': 'Transactions Fails.'}}
Also tried below,
bo_order = tsl.order_placement(tradingsymbol=options_name,
exchange='NFO',
quantity=orderbook[name]['qty'],
price=0,
trigger_price=0,
order_type='MARKET',
transaction_type='BUY',
trade_type='BO',
bo_profit_value=5,
bo_stop_loss_Value=5
)
Kindly help..
BR,
PK
@jhegdep Error DH-906 - Incorrect request for order and cannot be processed. Provide the values you are passing, rather than variables. Example:
orderid = tsl.order_placement(tradingsymbol='NIFTY 19 DEC 23300 CALL', exchange='NFO', quantity=75, price=0.05, trigger_price=0,order_type='LIMIT', transaction_type='BUY', trade_type='MIS')
Hi @jhegdep ,
Please check the reason for reason for transaction fails in dhan terminal.
Do I need include Dhan_Tradehull, Dhan_websocket models in current folder
PS F:\DHAN\2026\1. Option Chain> & C:/Users/Mahendra/AppData/Local/Programs/Python/Python313/python.exe “f:/DHAN/2026/1. Option Chain/Working with Option chain.py”
Traceback (most recent call last):
File “f:\DHAN\2026\1. Option Chain\Working with Option chain.py”, line 3, in
from Dhan_Tradehull import Tradehull
ModuleNotFoundError: No module named ‘Dhan_Tradehull’
PS F:\DHAN\2026\1. Option Chain>
Hi @Mahendra_Kadam ,
Do install the Dhan_Tradehull codebase, refer the steps in below link-
Confirm the installation by running the below commands-
pip show dhanhq
pip show Dhan-Tradehull
In “5. Live Options Algo PART 2.zip, - There is only one “IR Backtesting.txt” file existing. Kindly check and do the needful.
excellent job team Dhan and imran sir
When I am trying the following code, I am getting this error: “Exception in Getting OHLC data as Check the Tradingsymbol or Exchange”
opt_df = tsl.get_historical_data(tradingsymbol=‘CRUDEOILM 14 JAN 5300 CALL’, exchange=‘MCX’, timeframe=“5”)
When trying the following code, getting empty data:
fut_df = tsl.get_long_term_historical_data(tradingsymbol=‘SILVERM MAR FUT’, exchange=‘MCX’, timeframe=“5”,from_date=‘2023-01-01’,to_date=‘2025-12-11’)
Hi @deva ,
Make sure to verify the trading symbol, as it has already expired and data cannot be retrieved in either case.
Hi @Tradehull_Imran,
Getting following error with latest version of TradeHull. Pls guide which API to be used
File “C:\Users\Geetank\OneDrive\Documents\AI_Trading\LiveAlgoSession1\4. Live Options Algo Part 1\Historical Data\download data.py”, line 23, in
fut_df = tsl.get_long_term_historical_data(tradingsymbol=“SILVERM APR FUT”, exchange=“MCX”, timeframe=‘5’,from_date=“2023-01-01”,to_date=“2025-12-11”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘Tradehull’ object has no attribute ‘get_long_term_historical_data’
The provided code getting very complex while changing to Dhan, is there any way that we could get the tradehull account to use.
Hi @Ankita_Gupta ,
We have updated the Dhan_Tradehull Codebase ,
Do refer this link to upgrade the Dhan_Tradehull Codebase -
Hi @Chavala_Dhakshayani ,
Can you elaborate your query ?
@Tradehull_Imran Sir, Waiting for your revert on this
Do share the code .
Is it possible to get the history data of old expired future contracts for backtesting?
Hi @deva ,
Expired futures contract data is currently not available.
Do you have any dump, which can be downloaded?

