TP/SL Short Order

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?

Because you need to put side=‘BUY’ for your short position. i.e. the opposite of your entry position like you did for your long

Still not working. But thanks you so much

I don’t know how you can get TP working and not SL in this case then. But from what I recall closePosition = true and quantity shouldn’t be sent together, only either one.

1 Like

Please did you find the solution, because I have the same problem with Short Position .