From e0b14bcc15b5ce397733c2a965917ce17dd935b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 24 Jan 2018 15:50:59 +0100 Subject: [PATCH] Remove unnecessary dependency on ccxt --- portfolio.py | 6 +++--- test.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/portfolio.py b/portfolio.py index cb14c5d..9f82d88 100644 --- a/portfolio.py +++ b/portfolio.py @@ -1,4 +1,4 @@ -import ccxt +from ccxt import ExchangeError import time from decimal import Decimal as D # Put your poloniex api key in market.py @@ -304,11 +304,11 @@ class Trade: try: cls.ticker_cache[(c1, c2, market.__class__)] = market.fetch_ticker("{}/{}".format(c1, c2)) augment_ticker(cls.ticker_cache[(c1, c2, market.__class__)]) - except ccxt.ExchangeError: + except ExchangeError: try: cls.ticker_cache[(c2, c1, market.__class__)] = market.fetch_ticker("{}/{}".format(c2, c1)) augment_ticker(cls.ticker_cache[(c2, c1, market.__class__)]) - except ccxt.ExchangeError: + except ExchangeError: cls.ticker_cache[(c1, c2, market.__class__)] = None return cls.get_ticker(c1, c2, market) diff --git a/test.py b/test.py index 1b8a109..daf5fe4 100644 --- a/test.py +++ b/test.py @@ -426,10 +426,10 @@ class TradeTest(unittest.TestCase): market = mock.Mock() market.fetch_ticker.side_effect = [ { "bid": 1, "ask": 3 }, - portfolio.ccxt.ExchangeError("foo"), + portfolio.ExchangeError("foo"), { "bid": 10, "ask": 40 }, - portfolio.ccxt.ExchangeError("foo"), - portfolio.ccxt.ExchangeError("foo"), + portfolio.ExchangeError("foo"), + portfolio.ExchangeError("foo"), ] ticker = portfolio.Trade.get_ticker("ETH", "ETC", market) @@ -606,7 +606,7 @@ class AcceptanceTest(unittest.TestCase): "ask": D("0.0012") } if symbol == "USDT/BTC": - raise portfolio.ccxt.ExchangeError + raise portfolio.ExchangeError if symbol == "BTC/USDT": return { "symbol": "BTC/USDT", -- 2.41.0