Search code examples
pythonpython-3.xcryptocurrencybinancebinance-api-client

Short Order on Binance futures testnet resulting in APIError (ReduceOnly Order is Rejected)


On using futures testnet API through python-binance library: https://github.com/sammchardy/python-binance

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


Solution

  • Figured the problem. The side needs to be 'SELL' to short.