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:
- 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?