Bracket order - Python code

Can someone please help and provide the sample code for placing and modifying the bracket order. I have tried multiple things and even took help from ChatGPT, still it is not working well.

Also, if someone can help, what the below error is, I am getting while updating an ‘PENDING’ StopLoss order as below.

tsl.modify_order(
appOrderID = order_id,
modifiedOrderType=‘STOP_LOSS_MARKET’,
modifiedOrderQuantity=1,
modifiedLimitPrice=6.9,
modifiedStopPrice=6.9,
trade_type=‘MIS’
)

Traceback (most recent call last):
File “c:\Users\anura\OneDrive\Desktop\Anurag\dhan\DhanHQ-py\Strategy\Dhan_Tradehull_V2.py”, line 1373, in modify_order
p_orders = pd.DataFrame(self.xts1.get_order_book()[‘result’])
^^^^^^^^^
AttributeError: ‘Tradehull’ object has no attribute ‘xts1’

Sorry, if I have asked two questions in the same post.

Hi @anuragbhumca07 ,

Firstly do update to our latest codebase version 3.0.6:

  • 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

Guide to use the updated codebase:
Video reference :

Kindly refer the below pypi link for more details:
https://pypi.org/project/Dhan-Tradehull/

You can place bracket order using the below code:

orderid = tsl.order_placement(tradingsymbol = 'ACC', exchange = 'NSE', quantity = 1, price = 0, trigger_price = 0, order_type = 'MARKET', transaction_type = 'BUY', trade_type = 'BO', bo_profit_value=None, bo_stop_loss_value=None)