Spot Testnet - Failure to provide TP and SL

Hello everyone, I’m currently trying to write an algorithm on the spot test network and have encountered a misunderstanding on how to correctly create orders, namely:

  1. I send an order to buy on the market, for example for 1000 dollars (This is the first order)
#params_order = {
# "symbol": "BNBUSDT",
# "side": "BUY",
# "type": "MARKET",
# "quoteOrderQty": 1000

# response_order = send_signed_request("POST", "api/v3/order", params_order)

Then I look at the BNB balance, I get about 4.9 pieces,
{'asset': 'BNB', 'free': '4.90000000', 'locked': '0'

2.Then I send a separate stop loss order: (Second order)

# params_SL = {
# "symbol": "BNBUSDT",
# "side": "SELL",
# "type": "STOP_LOSS_LIMIT",
# "stopPrice": SL_sell_stopPrice,
# "price": SL_sell,
# "quantity": quantity_in_coin, (The quantity is taken from the first point, i.e. 4.9)
# "timeInForce": "GTC"
# }

Then I look at the BNB balance, I get about 0 and let’s say 4.9 blocked pieces,
{'asset': 'BNB', 'free': '0.00000000', 'locked': '4.90000000'}

3.Then I send a separate order for Take Profit (Third Order), but here, when I try, I no longer have free coins, they are blocked
An error appears that my balance is not enough.

Question: how to place stop loss and take profit orders correctly?

In your step3 that trying to place a NEW order, it returns error because there is no free balance.

I think what you are interested in is the OCO order, please feel free to check it from the document: