I just simply want to CLOSE a opened position at market price without extra features…
Example in the futures website portion : there is a section “close” and a button “market”
when we hit the market button => it instantly close the position no matter what…
I want the EXCAT behaviour that this market close button via the API.
** I can OPEN a position at market price with this:
symbol=BTCUSDT&side=SELL&positionSide=SHORT&type=MARKET&quantity=0.01
** But when I try to close it with this
without stopPrice:
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true
I get Stop price less than zero.
with stopPrice :
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true&stopPrice=30895.00
I get Order’s position side does not match user’s setting.
different type:
symbol=BTCUSDT&side=SELL&type=STOP&closePosition=true&stopPrice=30895.00
ProfitTarget strategy invalid for orderType STOP
The issue with this workaround, is 1. if the quantity is larger than the max quantity i get an errror from binance (-4005) and 2. if the quantity is lower than the min order quantity i get also an error (-1013 or -4164) anyhow better would be the funktion as requested would work, but it does not.
Any idea what we can do when we want to use the app “close” funktionality?
How do you mean? This are the exactly errors. Is there any approach to close a future position (trade) without setting the quantity and side? As in the app, just push close by market and the complete position will be closed, no matter the size of position.
When you have an open position normally you close that position by placing a new order of opposite direction. For example, if you have an open position with the side ‘BUY’, you can close that by placing a new order with the side ‘SELL’. Params may vary to close an opposite position depending on your current open position.
Following is the situation that works for me
Open Position Params
I will recommend using the inspect element → network tab
if you have an open position and close that by clicking the market button you will see a place_order request. Open the payload and see all the parameters required to close the current open position. You might see some useless params but most of the parameters are useful. I have attached the image of my network tab that might be helpful. I have closed an open position of side ‘SELL’.