Close open Position using API DELETE request

Hei Traders,

im just getting started with API Requests, so there are still a lot of ??? around me!!

I was able to place an order with API Request. Now i want to close it.

The Documentation says, the parameters should be the symbol, either orderId or origClientOrderId and timestamp.

when i do my Delete Request, i get this Answer(see below).

https://fapi.binance.com/fapi/v1/order?symbol=ADAUSDT&orderid=11941279625&timestamp=1618335360811&signature=signature
{'code': -2011, 'msg': 'Unknown order sent.'}

Pls help me, to set up correct URL.

Thanks a lot.

The only possible reason is it’d already filled before you sent the cancellation if your symbol/orderId are both correct

Thank you, for your advise!

How can my sellorder get filled and is still active? I dont get it.

My API call to close my existing open position, does not close the position. At the moment i have to close the position manualy.

Below you can see my POST and DELETE request to open and close a position and the data send back from binance.com.

POST https://fapi.binance.com/fapi/v1/order?symbol=ADAUSDT&side=BUY&type=MARKET&quantity=20&timestamp=1618391114071&signature=[....]
{'avgPrice': '0.00000',
 'clientOrderId': 'yimQ5WPFaUrDEPPOkviHSk',
 'closePosition': False,
 'cumQty': '0',
 'cumQuote': '0',
 'executedQty': '0',
 'orderId': 11968320014,
 'origQty': '20',
 'origType': 'MARKET',
 'positionSide': 'BOTH',
 'price': '0',
 'priceProtect': False,
 'reduceOnly': False,
 'side': 'BUY',
 'status': 'NEW',
 'stopPrice': '0',
 'symbol': 'ADAUSDT',
 'timeInForce': 'GTC',
 'type': 'MARKET',
 'updateTime': 1618391114269,
 'workingType': 'CONTRACT_PRICE'}


DELETE https://fapi.binance.com/fapi/v1/order?symbol=ADAUSDT&clientOrderId=yimQ5WPFaUrDEPPOkviHSk&timestamp=1618391242993&signature=[....]
{'code': -2011, 'msg': 'Unknown order sent.'}

I think i got it by my self.

I want to DELETE a order, but i have a open position (order got filled already).

To close a position i have to POST a sell order?! Correct?

Correct. What you did was order cancellation on a market order. Like I said it’s already filled before you sent cancellation