From 942792f1233f35eba31d51d96ecbc92163376af1 Mon Sep 17 00:00:00 2001 From: Yazeed Al Oyoun Date: Fri, 20 Mar 2020 05:48:53 +0100 Subject: [PATCH] updated as suggested --- freqtrade/freqtradebot.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index e5ae9043a..378252c29 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -394,21 +394,23 @@ class FreqtradeBot: logger.info(f"Pair {pair} is currently locked.") return False + # get_free_open_trades is checked before create_trade is called + # but it is still used here to prevent opening too many trades within one iteration if not self.get_free_open_trades(): logger.debug(f"Can't open a new trade for {pair}: max number of trades is reached.") return False - stake_amount = self.get_trade_stake_amount(pair) - if not stake_amount: - logger.debug(f"Stake amount is 0, ignoring possible trade for {pair}.") - return False - # running get_signal on historical data fetched (buy, sell) = self.strategy.get_signal( pair, self.strategy.ticker_interval, self.dataprovider.ohlcv(pair, self.strategy.ticker_interval)) if buy and not sell: + stake_amount = self.get_trade_stake_amount(pair) + if not stake_amount: + logger.debug(f"Stake amount is 0, ignoring possible trade for {pair}.") + return False + logger.info(f"Buy signal found: about create a new trade with stake_amount: " f"{stake_amount} ...")