Reduce complexity in binance stoploss handling
This commit is contained in:
parent
93237efc15
commit
8639c1f23d
@ -48,13 +48,12 @@ class Binance(Exchange):
|
|||||||
Returns True if adjustment is necessary.
|
Returns True if adjustment is necessary.
|
||||||
:param side: "buy" or "sell"
|
:param side: "buy" or "sell"
|
||||||
"""
|
"""
|
||||||
|
order_types = ('stop_loss_limit', 'stop', 'stop_market')
|
||||||
ordertype = 'stop' if self.trading_mode == TradingMode.FUTURES else 'stop_loss_limit'
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
order.get('stopPrice', None) is None
|
order.get('stopPrice', None) is None
|
||||||
or (
|
or (
|
||||||
order['type'] == ordertype
|
order['type'] in order_types
|
||||||
and (
|
and (
|
||||||
(side == "sell" and stop_loss > float(order['stopPrice'])) or
|
(side == "sell" and stop_loss > float(order['stopPrice'])) or
|
||||||
(side == "buy" and stop_loss < float(order['stopPrice']))
|
(side == "buy" and stop_loss < float(order['stopPrice']))
|
||||||
|
Loading…
Reference in New Issue
Block a user