Reduce complexity in binance stoploss handling

This commit is contained in:
Matthias 2022-09-17 10:56:27 +02:00
parent 93237efc15
commit 8639c1f23d

View File

@ -48,13 +48,12 @@ class Binance(Exchange):
Returns True if adjustment is necessary.
:param side: "buy" or "sell"
"""
ordertype = 'stop' if self.trading_mode == TradingMode.FUTURES else 'stop_loss_limit'
order_types = ('stop_loss_limit', 'stop', 'stop_market')
return (
order.get('stopPrice', None) is None
or (
order['type'] == ordertype
order['type'] in order_types
and (
(side == "sell" and stop_loss > float(order['stopPrice'])) or
(side == "buy" and stop_loss < float(order['stopPrice']))