I am trying to fetch the orderStatus with an infinite loop until the stop limit order is traded. however it never returns ‘TRADED’ status even when actually traded. Can you spot the issue.
status_flag = 0
while True:
if status_flag == 0:
order_status = buy_op_id[‘data’][‘orderStatus’]
print(order_status)
if order_status == ‘TRADED’:
print(order_status)
sell_op_id = place_Sell(security_id_1, price2, trigger_price2, quantity1)
status_flag = 1
if status_flag == 1:
break