BLD: updated CCXT and temporarily fixed symbol mapping issue

This commit is contained in:
Frederic Fortier
2018-01-18 21:57:11 -05:00
parent 540dd97dbf
commit 853707dfb2
7 changed files with 28 additions and 11 deletions
+2
View File
@@ -61,6 +61,7 @@ class CCXT(Exchange):
'apiKey': key,
'secret': secret,
})
self.api.enableRateLimit = True
except Exception:
raise ExchangeNotFoundError(exchange_name=exchange_name)
@@ -1001,6 +1002,7 @@ class CCXT(Exchange):
for asset in assets:
symbol = self.get_symbol(asset)
# Test the CCXT throttling further to see if we need this
self.ask_request()
# TODO: use fetch_tickers() for efficiency
+7 -2
View File
@@ -234,11 +234,15 @@ class Exchange:
"""
asset = None
# TODO: temp mapping, fix to use a single symbol convention
og_symbol = symbol
symbol = self.get_symbol(symbol) if not is_exchange_symbol else symbol
log.debug(
'searching assets for: {} {}'.format(
self.name, symbol
)
)
# TODO: simplify and loose the loop
for a in self.assets:
if asset is not None:
break
@@ -260,7 +264,8 @@ class Exchange:
# The symbol provided may use the Catalyst or the exchange
# convention
key = a.exchange_symbol if is_exchange_symbol else a.symbol
key = a.exchange_symbol if \
is_exchange_symbol else self.get_symbol(a)
if not asset and key.lower() == symbol.lower():
if applies:
asset = a
@@ -276,7 +281,7 @@ class Exchange:
supported_symbols = sorted([a.symbol for a in self.assets])
raise SymbolNotFoundOnExchange(
symbol=symbol,
symbol=og_symbol,
exchange=self.name.title(),
supported_symbols=supported_symbols
)
+8
View File
@@ -0,0 +1,8 @@
import ccxt
bitfinex = ccxt.bitfinex()
bitfinex.verbose = True
ohlcvs = bitfinex.fetch_ohlcv('ETH/BTC', '30m', 1504224000000)
dt = bitfinex.iso8601(ohlcvs[0][0])
print(dt) # should print '2017-09-01T00:00:00.000Z'
+1 -1
View File
@@ -81,6 +81,6 @@ empyrical==0.2.1
tables==3.3.0
#Catalyst dependencies
ccxt==1.10.565
ccxt==1.10.774
boto3==1.4.8
redo==1.6
+2 -2
View File
@@ -72,14 +72,14 @@ class TestCCXT(BaseExchangeTestCase):
def test_tickers(self):
log.info('retrieving tickers')
assets = [
self.exchange.get_asset('eng_eth'),
self.exchange.get_asset('iot_usd'),
]
tickers = self.exchange.tickers(assets)
assert len(tickers) == 1
pass
def test_my_trades(self):
asset = self.exchange.get_asset('eng_eth')
asset = self.exchange.get_asset('dsh_btc')
trades = self.exchange.get_trades(asset)
assert trades
@@ -117,7 +117,7 @@ class TestSuiteBundle:
# population=exchange_population,
# features=[bundle],
# ) # Type: list[Exchange]
exchanges = [get_exchange('bitfinex', skip_init=True)]
exchanges = [get_exchange('poloniex', skip_init=True)]
data_portal = TestSuiteBundle.get_data_portal(exchanges)
for exchange in exchanges:
@@ -15,6 +15,7 @@ from catalyst.exchange.utils.test_utils import select_random_exchanges, \
handle_exchange_error, select_random_assets
from catalyst.testing import ZiplineTestCase
from catalyst.testing.fixtures import WithLogger
from exchange.utils.factory import get_exchanges
log = Logger('TestSuiteExchange')
@@ -83,12 +84,13 @@ class TestSuiteExchange(WithLogger, ZiplineTestCase):
def test_tickers(self):
exchange_population = 3
asset_population = 3
asset_population = 15
exchanges = select_random_exchanges(
exchange_population,
features=['fetchTickers'],
) # Type: list[Exchange]
# exchanges = select_random_exchanges(
# exchange_population,
# features=['fetchTickers'],
# ) # Type: list[Exchange]
exchanges = list(get_exchanges(['bitfinex']).values())
for exchange in exchanges:
exchange.init()