aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-01-24 15:50:59 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-01-25 23:59:13 +0100
commite0b14bcc15b5ce397733c2a965917ce17dd935b3 (patch)
tree5ddb3b146d6cd3a7e7f1ec7c6a9f344bb6b4bb0e
parente2c6184cdf2c4a9f9bc809088056cc365d243b13 (diff)
downloadTrader-e0b14bcc15b5ce397733c2a965917ce17dd935b3.tar.gz
Trader-e0b14bcc15b5ce397733c2a965917ce17dd935b3.tar.zst
Trader-e0b14bcc15b5ce397733c2a965917ce17dd935b3.zip
Remove unnecessary dependency on ccxt
-rw-r--r--portfolio.py6
-rw-r--r--test.py8
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 @@
1import ccxt 1from ccxt import ExchangeError
2import time 2import time
3from decimal import Decimal as D 3from decimal import Decimal as D
4# Put your poloniex api key in market.py 4# Put your poloniex api key in market.py
@@ -304,11 +304,11 @@ class Trade:
304 try: 304 try:
305 cls.ticker_cache[(c1, c2, market.__class__)] = market.fetch_ticker("{}/{}".format(c1, c2)) 305 cls.ticker_cache[(c1, c2, market.__class__)] = market.fetch_ticker("{}/{}".format(c1, c2))
306 augment_ticker(cls.ticker_cache[(c1, c2, market.__class__)]) 306 augment_ticker(cls.ticker_cache[(c1, c2, market.__class__)])
307 except ccxt.ExchangeError: 307 except ExchangeError:
308 try: 308 try:
309 cls.ticker_cache[(c2, c1, market.__class__)] = market.fetch_ticker("{}/{}".format(c2, c1)) 309 cls.ticker_cache[(c2, c1, market.__class__)] = market.fetch_ticker("{}/{}".format(c2, c1))
310 augment_ticker(cls.ticker_cache[(c2, c1, market.__class__)]) 310 augment_ticker(cls.ticker_cache[(c2, c1, market.__class__)])
311 except ccxt.ExchangeError: 311 except ExchangeError:
312 cls.ticker_cache[(c1, c2, market.__class__)] = None 312 cls.ticker_cache[(c1, c2, market.__class__)] = None
313 return cls.get_ticker(c1, c2, market) 313 return cls.get_ticker(c1, c2, market)
314 314
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):
426 market = mock.Mock() 426 market = mock.Mock()
427 market.fetch_ticker.side_effect = [ 427 market.fetch_ticker.side_effect = [
428 { "bid": 1, "ask": 3 }, 428 { "bid": 1, "ask": 3 },
429 portfolio.ccxt.ExchangeError("foo"), 429 portfolio.ExchangeError("foo"),
430 { "bid": 10, "ask": 40 }, 430 { "bid": 10, "ask": 40 },
431 portfolio.ccxt.ExchangeError("foo"), 431 portfolio.ExchangeError("foo"),
432 portfolio.ccxt.ExchangeError("foo"), 432 portfolio.ExchangeError("foo"),
433 ] 433 ]
434 434
435 ticker = portfolio.Trade.get_ticker("ETH", "ETC", market) 435 ticker = portfolio.Trade.get_ticker("ETH", "ETC", market)
@@ -606,7 +606,7 @@ class AcceptanceTest(unittest.TestCase):
606 "ask": D("0.0012") 606 "ask": D("0.0012")
607 } 607 }
608 if symbol == "USDT/BTC": 608 if symbol == "USDT/BTC":
609 raise portfolio.ccxt.ExchangeError 609 raise portfolio.ExchangeError
610 if symbol == "BTC/USDT": 610 if symbol == "BTC/USDT":
611 return { 611 return {
612 "symbol": "BTC/USDT", 612 "symbol": "BTC/USDT",