Example code for usage of getting orderStatus

Situation : Here is a code snippet for Stop limit buying order for index option.

Help Needed : Pls provide the code basis this example code to check if order is ‘traded’ or not. If yes ->Print " Trade is executed"

from dhanhq import dhanhq
import pandas as pd

client_id = “123456”
access_token = “MyaccessCode”
dhan = dhanhq(client_id,access_token)

price1 = 5.9
trigger_price1 = price1 - 0.1

#Place a buy order in NFO
def place_Buy():
option_id = dhan.place_order(
transaction_type=dhan.BUY,
exchange_segment=dhan.NSE_FNO,
product_type=dhan.CNC,
order_type=dhan.SL,
security_id=40989,
quantity=50,
disclosed_quantity=0,
price=price1,
trigger_price=trigger_price1,
after_market_order=False,
bo_profit_value=0,
bo_stop_loss_Value=0,
drv_expiry_date=None,
drv_options_type=None,
drv_strike_price=None
)
return option_id

op_id = place_Buy()
print(op_id)

@Dev

Maybe someone from community here can assist you, basically need to use

dhan.get_order_by_id(order_id)