Close the whole position

I was creating a stop_market order for my opened position, but when I was fetching and giving the quantity , i feel like maybe in the future i would do a mistake in some small units, and that small units are going to be in the open position

But when i tried manually to create a stop market order , the quantity was something like this “Close Position” as in the image below

param I was using to create an order
{
symbol: ‘BTC/USDT:USDT’,
type: ‘stop_market’,
side: ‘sell’,
quantity: 0.005,
stopLossPrice: 30652.18159758678,
params: { stopLossPrice: 30652.18159758678 }
}

How can i create a stop_market order with quantity : “Close Position” using binance API ?

Hey,
Have you considered setting the closePosition parameter to true?
Note that in this case, you won’t be able to specify a quantity. For more details, refer to the documentation: new-order-trade