Binance Futures Reduce Only

Are you trying to create both LONG and SHORT positions on Binance Futures but encountering an error message? Don’t worry, you’re not alone. Many traders face the same issue when attempting to execute similar code for both types of positions. In this article, we will explore the reason behind this error and provide a solution to help you overcome it.

Understanding the Error

When executing the code for creating a SHORT position, you may encounter the following error message: “APIError(code=-1128): Combination of optional parameters invalid.” This error arises due to the specific combination of parameters required to create a SHORT position on Binance Futures.

Resolving the Issue

To successfully create a SHORT position, you need to modify the code. Here’s an example of the updated code 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
)

Ensure that you replace the previous code, which was used for creating a LONG position, with the updated code for creating a SHORT position. By doing so, you will resolve the error and be able to execute the desired trade successfully.

Conclusion

Creating both LONG and SHORT positions on Binance Futures can be a powerful strategy for traders. However, it’s crucial to ensure that the correct parameters are used when executing the code. By following the above guidelines and implementing the necessary modifications, you can overcome the “Combination of optional parameters invalid” error and execute your trades without any issues.

Remember, practice makes perfect. Don’t hesitate to reach out to the Binance support team if you have any further questions or concerns. Happy trading!