From f551fb5ff7c135b039047cbae970e002e6c709f3 Mon Sep 17 00:00:00 2001 From: hroff-1902 <47309513+hroff-1902@users.noreply.github.com> Date: Wed, 13 Feb 2019 03:14:24 +0300 Subject: [PATCH] adjusted for passing tests Don't like this test_ticker parameter, but it's needed for tests to pass prepared ticker. Any ideas? --- freqtrade/freqtradebot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 4671b6053..0183b5dc6 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -204,9 +204,10 @@ class FreqtradeBot(object): self.state = State.STOPPED return state_changed - def get_target_bid(self, pair: str) -> float: + def get_target_bid(self, pair: str, test_ticker: Dict[str, float]) -> float: """ Calculates bid target between current ask price and last price + :param test_ticker: Ticker to use for getting Ask and Last Price; left for tests :return: float: Price """ config_bid_strategy = self.config.get('bid_strategy', {}) @@ -222,7 +223,10 @@ class FreqtradeBot(object): used_rate = order_book_rate else: logger.info('Using Last Ask / Last Price') - ticker = self.exchange.get_ticker(pair) + if test_ticker is not None: + ticker = test_ticker + else: + ticker = self.exchange.get_ticker(pair) if ticker['ask'] < ticker['last']: ticker_rate = ticker['ask'] else: