Use Dict instead of tuplelist, run in _process

This commit is contained in:
Matthias 2018-07-31 20:25:10 +02:00
parent 154e4569d7
commit a486b1d01c

View File

@ -149,6 +149,10 @@ class FreqtradeBot(object):
final_list = sanitized_list[:nb_assets] if nb_assets else sanitized_list
self.config['exchange']['pair_whitelist'] = final_list
datatups = asyncio.get_event_loop().run_until_complete(
self.exchange.async_get_tickers_history(final_list, self.strategy.ticker_interval))
self._klines = {pair: data for (pair, data) in datatups}
# Query trades from persistence layer
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
@ -339,14 +343,14 @@ class FreqtradeBot(object):
# fetching kline history for all pairs asynchronously and wait till all done
data = asyncio.get_event_loop().run_until_complete(self.exchange.async_get_tickers_history(whitelist, self.strategy.ticker_interval))
# data = asyncio.get_event_loop().run_until_complete(self.exchange.async_get_tickers_history(whitelist, self.strategy.ticker_interval))
# list of pairs having buy signals
buy_pairs = []
# running get_signal on historical data fetched
# to find buy signals
for _pair, thistory in data:
for _pair, thistory in self._klines.items():
(buy, sell) = self.strategy.get_signal(_pair, interval, thistory)
if buy and not sell:
buy_pairs.append(_pair)
@ -518,7 +522,8 @@ class FreqtradeBot(object):
(buy, sell) = (False, False)
experimental = self.config.get('experimental', {})
if experimental.get('use_sell_signal') or experimental.get('ignore_roi_if_buy_signal'):
ticker = self.exchange.get_ticker_history(trade.pair, self.strategy.ticker_interval)
# ticker = self.exchange.get_ticker_history(trade.pair, self.strategy.ticker_interval)
ticker = self._klines[trade.pair]
(buy, sell) = self.strategy.get_signal(trade.pair, self.strategy.ticker_interval,
ticker)