2

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

tzharg
  • 313
  • 2
  • 11

2 Answers2

2

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

tzharg
  • 313
  • 2
  • 11
0

The "Position Side" need to be BOTH (Buy/Sell is for reduce existing order only).

Then the "Side" Buy for LONG and Sell for SHORT.

TPG
  • 2,811
  • 1
  • 31
  • 52