binance stop loss and take profit

I made a bot for binance using the binance python library According to my analytics, the result is data like ‘TRBUSDT’: ‘buy’, ‘PONDUSDT’: ‘sell’

for each coin I open a market order


market_order = self.client.order_market_buy(symbol=self.symbol, quoteOrderQty=10)

or sell

market_order = self.client.order_market_sell(symbol=self.symbol, quoteOrderQty=10)

I can’t figure out how to add stop loss and take profit to each order


Change the order type to STOP_LOSS or TAKE_PROFIT and add a stopPrice to the request.

1 Like

Thank you very much, something like this?

stop_loss = self.client.ORDER_TYPE_STOP_LOSS(symbol=self.symbol,stopPrice=stopPrice)
take_profit = self.client.ORDER_TYPE_TAKE_PROFIT(symbol=self.symbol,stopPrice=stopPrice)

For guidance on how to use the library, please direct this question to the owner of the library (Github Issues).