From b24a22b0b6033ce8a3ca1df6ff599490afb37ee3 Mon Sep 17 00:00:00 2001 From: iuvbio Date: Tue, 5 Mar 2019 19:45:10 +0100 Subject: [PATCH] use self.markets instead of get_markets --- freqtrade/freqtradebot.py | 10 ++++------ freqtrade/pairlist/IPairList.py | 6 ++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index dce3136df..939904c73 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -280,12 +280,10 @@ class FreqtradeBot(object): return stake_amount def _get_min_pair_stake_amount(self, pair: str, price: float) -> Optional[float]: - markets = self.exchange.get_markets() - markets = [m for m in markets if m['symbol'] == pair] - if not markets: - raise ValueError(f'Can\'t get market information for symbol {pair}') - - market = markets[0] + try: + market = self.exchange.markets[pair] + except KeyError: + raise ValueError(f"Can't get market information for symbol {pair}") if 'limits' not in market: return None diff --git a/freqtrade/pairlist/IPairList.py b/freqtrade/pairlist/IPairList.py index 948abe113..5559c582f 100644 --- a/freqtrade/pairlist/IPairList.py +++ b/freqtrade/pairlist/IPairList.py @@ -66,12 +66,14 @@ class IPairList(ABC): black_listed """ sanitized_whitelist = whitelist - markets = self._freqtrade.exchange.get_markets() + markets = self._freqtrade.exchange.markets # Filter to markets in stake currency - markets = [m for m in markets if m['quote'] == self._config['stake_currency']] + markets = [markets[pair] for pair in markets if + markets[pair]['quote'] == self._config['stake_currency']] known_pairs = set() + # TODO: we should loop over whitelist instead of all markets for market in markets: pair = market['symbol'] # pair is not in the generated dynamic market, or in the blacklist ... ignore it