Skip to content

Commit

Permalink
simplify stoploss_oe code
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Aug 31, 2019
1 parent f0c0f56 commit 7fc1566
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions freqtrade/freqtradebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,15 +655,10 @@ def handle_stoploss_on_exchange(self, trade: Trade) -> bool:
except InvalidOrderException as 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_fulfilled and not stoploss_order):
if self.edge:
stoploss = self.edge.stoploss(pair=trade.pair)
else:
stoploss = self.strategy.stoploss
if (not trade.open_order_id and not stoploss_order):

stoploss = self.edge.stoploss(pair=trade.pair) if self.edge else self.strategy.stoploss

stop_price = trade.open_rate * (1 + stoploss)

Expand Down

0 comments on commit 7fc1566

Please sign in to comment.