From 69507d1b004ed4a13bcdccb5b3fc143d445aa615 Mon Sep 17 00:00:00 2001 From: Frederic Fortier Date: Wed, 31 Jan 2018 16:32:22 -0500 Subject: [PATCH] BLD: for issue #178, fixed the "set" issue when fetching a ticker from positions --- catalyst/exchange/ccxt/ccxt_exchange.py | 4 ++-- catalyst/exchange/exchange.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/catalyst/exchange/ccxt/ccxt_exchange.py b/catalyst/exchange/ccxt/ccxt_exchange.py index 3e5d5b29..2d770c8b 100644 --- a/catalyst/exchange/ccxt/ccxt_exchange.py +++ b/catalyst/exchange/ccxt/ccxt_exchange.py @@ -998,13 +998,13 @@ class CCXT(Exchange): """ if len(assets) == 1: - symbol = self.get_symbol(assets[0]) try: + symbol = self.get_symbol(assets[0]) log.debug('fetching single ticker: {}'.format(symbol)) results = dict() results[symbol] = self.api.fetch_ticker(symbol=symbol) - except (ExchangeError, NetworkError) as e: + except (ExchangeError, NetworkError, Exception) as e: log.warn( 'unable to fetch ticker {} / {}: {}'.format( self.name, symbol, e diff --git a/catalyst/exchange/exchange.py b/catalyst/exchange/exchange.py index 84cac446..f32d9a2b 100644 --- a/catalyst/exchange/exchange.py +++ b/catalyst/exchange/exchange.py @@ -703,7 +703,7 @@ class Exchange: positions_value = 0.0 if positions: - assets = set([position.asset for position in positions]) + assets = list(set([position.asset for position in positions])) tickers = self.tickers(assets) for position in positions: