can anyone help with this?
here is my code for creating a position:
order_succeeded, quantity, entry_price = order(SIDE_SELL, TRADE_AMOUNT, TRADE_TICK, "LONG")
def order(side, quantity, symbol, positionSide, order_type=FUTURE_ORDER_TYPE_MARKET):
try:
print("\n---> sending order")
order = client.futures_create_order(symbol=symbol, side=side, type=order_type,
positionSide=positionSide, quantity=quantity)
order_id = int(order['orderId'])
order_info = client.futures_get_order(symbol=TRADE_TICK, orderId=order_id)
entry_price = float(order_info["avgPrice"])
qty = float(order_info["executedQty"])
print(f"\n\n---> completed {qty} @ ${entry_price}")
except Exception as e:
print(f"an exception occured - {e}")
return False
return True, qty, entry_price
if order_succeeded:
do_some_stuff()
my issue is that the action will go to exchange and execute, but occasionally the response i get is:
apierror(code=-2013): order does not exist
even though the order did go through correctly…
looking for some ideas on how to approach this, thanks