Hello,
I am trying to use Query Order (USER_DATA) in my code but have been getting an error
this is part of my code:
def place_tp(self, symbol, price, t_position_amt, direction):
response = None
try:
if direction == "LONG":
response = self.sell_limit(symbol, t_position_amt, price)
if response and isinstance(response, dict) and 'orderId' in response:
return response['orderId']
return response['orderId'] # Ensure you're returning the order ID here
except Exception as e:
print(f"Error in place_tp: {e}")
return None # Return None if there's any error
and also later:
tp_order_info = client.futures_get_order(symbol=self.symbol, orderId=tp_order_id)
if tp_order_info['status'] == 'FILLED':
but i always get an error:
SL order ID: None
Error: Unable to get order IDs for TP or SL orders.
can anyone help me?