]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/commitdiff
Remove unnecessary dependency on ccxt
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 24 Jan 2018 14:50:59 +0000 (15:50 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 25 Jan 2018 22:59:13 +0000 (23:59 +0100)
portfolio.py
test.py

index cb14c5d6223d44751f6f99d1f886e9a8aa5de7c2..9f82d881fcfac30e440b06d3e3c423167c994ce2 100644 (file)
@@ -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 1b8a109ce64d6286541c88a86b86ccc0d288638d..daf5fe4bf8c3354229703a12b33ffc615db136c4 100644 (file)
--- 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",