diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index 9c432d968..ec80dfb80 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -149,6 +149,7 @@ def get_ticker(pair: str, refresh: Optional[bool] = True) -> dict: @cached(TTLCache(maxsize=100, ttl=30)) def get_ticker_history(pair: str, tick_interval) -> List[Dict]: + ## implement https://github.com/ccxt/ccxt/blob/master/python/ccxt/bittrex.py#L394-L400 return _API.get_ticker_history(pair, tick_interval) @@ -179,7 +180,13 @@ def get_markets() -> List[str]: def get_market_summaries() -> List[Dict]: - return _API.public_get_marketsummaries()['result'] + # TODO: check other exchanges how they implement market summaries + summaries = _API.public_get_marketsummaries()['result'] + for market in summaries: + name = market['MarketName'].split('-') + market['MarketName'] = name[-1] + '/' + name[0] + return summaries + def get_name() -> str: diff --git a/freqtrade/main.py b/freqtrade/main.py index 8a1397d94..b3d40311b 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -35,8 +35,9 @@ def refresh_whitelist(whitelist: List[str]) -> List[str]: sanitized_whitelist = whitelist health = exchange.get_wallet_health() known_pairs = set() + for status in health: - pair = '{}_{}'.format(_CONF['stake_currency'], status['Currency']) + pair = '{}/{}'.format(status['Currency'], _CONF['stake_currency']) # pair is not int the generated dynamic market, or in the blacklist ... ignore it if pair not in whitelist or pair in _CONF['exchange'].get('pair_blacklist', []): continue @@ -374,7 +375,10 @@ def create_trade(stake_amount: float, interval: int) -> bool: 'Checking buy signals to create a new trade with stake_amount: %f ...', stake_amount ) + whitelist = copy.deepcopy(_CONF['exchange']['pair_whitelist']) + print('*******whitelist {}*****'.format(whitelist)) + # Check if stake_amount is fulfilled if exchange.get_balance(_CONF['stake_currency']) < stake_amount: raise DependencyException( @@ -466,14 +470,12 @@ def gen_pair_whitelist(base_currency: str, key: str = 'BaseVolume') -> List[str] :param key: sort key (defaults to 'BaseVolume') :return: List of pairs """ - summaries = sorted( (s for s in exchange.get_market_summaries() if s['MarketName'].endswith(base_currency)), key=lambda s: s.get(key) or 0.0, reverse=True ) - - return [s['MarketName'].replace('-', '_') for s in summaries] + return [s['MarketName'] for s in summaries] def cleanup() -> None: