Trying to program an API trading algorithm- I need to check whether an order has been filled, and if it has been filled, place the new order, and if the order has not been filled or there is no order, do nothing (return). The variable that holds 'Filled' or 'Not filled' is only declared if there is an open order. I want it to basically send the order if the variable is 'Filled', and ALSO send the order if the variable is undefined, but NOT send the order if it is unfilled and undefined (no orders ever sent, ie. initial run through)...
The original problem is that it sends a second order even if the previous order is not filled yet, so I created a variable in the 'openOrders' function that shows the status of the order. But if there are no orders, the variable is undefined. So I want it to send the order if it is undefined (no orders), and send the order if the variable is 'filled'.
I had this code but the first line throws it off because it doesn't recognize none as undefined. Any suggestions?
if self.openOrderStatus == None: #<--
# SELL
elif self.openOrderStatus != 'Filled':
return
else:
# SELL