Why do you get 'reduceOnly rejection' errors

Q:
When you place an order with ‘reduceOnly=true’ in one-way mode or ‘SELL LONG’/‘BUY SHORT’ in hedge mode, you could get below error:
“-2022: ReduceOnly Order is rejected”
What could be the possible reasons?

A:
Several reasons you might want to check for reduceOnly order rejection:

  1. You don’t have any position to close
  2. You’re at the edge of liquidation
  3. You have other open orders that would be filled before the failed one and close all positions

A little bit explanation for #3 -

Let’s say your current position is 1 BTC for short; And you have an open order to close this BTC at 10000; If you place another order to close 1 BTC at 9999, it’d be rejected. (Because the order with 10000 for sure would be filled and close everything before this “9999” order )

If you still think you shouldn’t have been rejected after checking above things, please contact CS

1 Like

When you place an order with ‘reduceOnly=true’ in one-way mode or ‘SELL LONG’/‘BUY SHORT’ in hedge mode,

@MJW on going through all your answer and comments regarding this error, I’m not able to figure this out:
On futures testnet:
I am getting this in ‘Buy Short’ in Hedge mode. I am able to execute the same order via the UI and it works. I am able to use the API for ‘Buy Long’ orders successfully.
Here is my code sample:

short_order={      "symbol":"BTCUSDT",
            "side": "BUY",
            "type": "MARKET",
            "positionSide" : "SHORT",
            "quantity": "0.001"}
res = client.futures_create_order(**short_order)
print(res)

Getting this response:
BinanceAPIException: APIError(code=-2022): ReduceOnly Order is rejected.

Is there something that I’m doing wrong to place the Short order. Reduce-only parameter is mentioned that it is not used in Hedge mode according to API docs.
Thanks for your help

Thanks a lot @vvin
I figured that as well and missed closing the loop on this. Ran into this since I am relatively a trading noob. The binance telegram group was also pretty helpful to answer questions.
Now working towards trying to backtest on binance futures… since most bots dont have futures support out of the box. Would love to know if you’re working on something similar!

@Tushar_Gerg
If you want to open a short position, your order side should be ‘SELL’.
Similarly, if you want to close a short position, your side should be ‘BUY’, and in close a short position your position should be negative

example:
creat position:
{
symbol = symbol,
side = ‘BUY’ if side == ‘LONG’ else ‘SELL’,
positionSide = side,
type = ‘MARKET’,
quantity = quantitys)
}

close position:
{
symbol = symbol,
side = ‘BUY’ if side == “SHORT” else ‘SELL’,
positionSide = side,
type = ‘MARKET’,
quantity = -quantity if side == “SHORT” else quantity)
}

This problem has bothered me for a long time. I solved this error today. I hope it helps you.
Please forgive me if there is something wrong with the grammar haha.my english is really poor

I am able to create a LONG Position with TP and SL connected with the position doing that:

                order = client.futures_create_order(
                    symbol=symbol,
                    side=SIDE_BUY,
                    positionSide = "LONG",
                    type=ORDER_TYPE_MARKET,
                    quantity=quantity,
                )
                stop_loss = client.futures_create_order(
                        symbol=symbol,
                        side='SELL',
                        type='STOP_MARKET',
                        quantity = quantity,
                        positionSide = "LONG",
                        stopPrice = stop_market,
                        closePosition = True
                )

                order_take = client.futures_create_order(
                        symbol=symbol, 
                        side='SELL', 
                        type='TAKE_PROFIT_MARKET',
                        quantity = quantity,
                        positionSide = "LONG",
                        stopPrice = take_profit,
                        closePosition = True
                )

But with that similar code I am not able to create a SHORT Position:

                order = client.futures_create_order(
                    symbol=symbol,
                    side=SIDE_SELL,
                    positionSide = "SHORT",
                    type=ORDER_TYPE_MARKET,
                    quantity=quantity,
                )
                stop_loss = client.futures_create_order(
                        symbol=symbol,
                        side='SELL',
                        type='STOP_MARKET',
                        quantity = quantity,
                        positionSide = "SHORT",
                        stopPrice = stop_market,
                        closePosition = True
                )

                order_take = client.futures_create_order(
                        symbol=symbol, 
                        side='SELL', 
                        type='TAKE_PROFIT_MARKET',
                        quantity = quantity,
                        positionSide = "SHORT",
                        stopPrice = take_profit,
                        closePosition = True
                )

I am receiving this error:
APIError(code=-1128): Combination of optional parameters invalid.

How can I solve that? Maybe I am missing something?

try this out for sell trades:

order = client.futures_create_order(
                    symbol=symbol,
                    side=SIDE_SELL,
                    positionSide = "SHORT",
                    type=ORDER_TYPE_MARKET,
                    quantity=quantity,
                )
                stop_loss = client.futures_create_order(
                        symbol=symbol,
                        side='BUY',
                        type='STOP_MARKET',
                        quantity = quantity,
                        positionSide = "SHORT",
                        stopPrice = stop_market,
                        closePosition = True
                )
                order_take = client.futures_create_order(
                        symbol=symbol, 
                        side='BUY', 
                        type='TAKE_PROFIT_MARKET',
                        quantity = quantity,
                        positionSide = "SHORT",
                        stopPrice = take_profit,
                        closePosition = True
                )

You’re welcome @Tushar_Gerg
I’m glad you figured this problem.I’m trading rookie too not working on something similar.
just use my free time to make trading bot

@Tushar_Gerg What was the solution for you? I get the same error, but only on some of the orders (all with ‘SELL LONG’/‘BUY SHORT’ in hedge mode). It’s strange because it looks like the orders are executed anyway. I don’t actually send the reduceOnly parameter but when I look at the Binance website I see that all the “Close Short” and “Close Long” orders have “Reduce Only: Yes” in the order history.