simplify stoploss_oe code

This commit is contained in:
Matthias 2019-08-31 16:15:39 +02:00
parent f0c0f5618b
commit 7fc156648a

View File

@ -655,15 +655,10 @@ class FreqtradeBot(object):
except InvalidOrderException as exception: except InvalidOrderException as exception:
logger.warning('Unable to fetch stoploss order: %s', exception) logger.warning('Unable to fetch stoploss order: %s', exception)
# If trade open order id does not exist: buy order is fulfilled
buy_order_fulfilled = not trade.open_order_id
# If buy order is fulfilled but there is no stoploss, we add a stoploss on exchange # If buy order is fulfilled but there is no stoploss, we add a stoploss on exchange
if (buy_order_fulfilled and not stoploss_order): if (not trade.open_order_id and not stoploss_order):
if self.edge:
stoploss = self.edge.stoploss(pair=trade.pair) stoploss = self.edge.stoploss(pair=trade.pair) if self.edge else self.strategy.stoploss
else:
stoploss = self.strategy.stoploss
stop_price = trade.open_rate * (1 + stoploss) stop_price = trade.open_rate * (1 + stoploss)