Hello
I have started to work with testnet API .
I read already some threads about closing orders but I cannot make it work for me.
my scenario
I have opened few BUY Market orders using /api/v3/order
one example
testnet.binance.vision/api/v3/order
params = {
‘symbol’: ‘BTCUSDT’,
‘side’: ‘BUY’,
‘type’: ‘MARKET’,
‘quantity’: ‘0.1’,
}
output
{‘symbol’: ‘BTCUSDT’, ‘orderId’: 6736801, ‘orderListId’: -1, ‘clientOrderId’: ‘CFnCqUbqfLpC3YrvLR13qU’, ‘transactTime’: 1708788892618, ‘price’: ‘0.00000000’, ‘origQty’: ‘0.10000000’, ‘executedQty’: ‘0.10000000’, ‘cummulativeQuoteQty’: ‘5113.15474110’, ‘status’: ‘FILLED’, ‘timeInForce’: ‘GTC’, ‘type’: ‘MARKET’, ‘side’: ‘BUY’, ‘workingTime’: 1708788892618,
‘fills’: [{‘price’: ‘51129.23000000’, ‘qty’: ‘0.00802000’, ‘commission’: ‘0.00000000’, ‘commissionAsset’: ‘BTC’, ‘tradeId’: 1329128}, …
‘selfTradePreventionMode’: ‘EXPIRE_MAKER’}
I get use GET myTrades API
testnet.binance.vision/api/v3/myTrades?symbol=BTCUSDT&orderId=6736801
[{‘symbol’: ‘BTCUSDT’, ‘id’: 1329128, ‘orderId’: 6736801, ‘orderListId’: -1, ‘price’: ‘51129.23000000’, ‘qty’: ‘0.00802000’, ‘quoteQty’: ‘410.05642460’, ‘commission’: ‘0.00000000’, ‘commissionAsset’: ‘BTC’, ‘time’: 1708788892618, ‘isBuyer’: True, ‘isMaker’: False, ‘isBestMatch’: True},
{‘symbol’: ‘BTCUSDT’, ‘id’: 13291
…
but HOW I suppose to close this position ?
what I understood that - it should be API order call with side SELL …
but this endpoint does not have an option to specify orderID to be closed
assuming I have more than 1 position opened … how to specify this action properly ?
what I am missing on API doc ?
looking forward to hearing from you