mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-25 13:10:33 +08:00
Fix issue with retrieving bundles
This commit is contained in:
@@ -7,7 +7,7 @@ from catalyst.api import symbol
|
||||
|
||||
def initialize(context):
|
||||
print('initializing')
|
||||
context.asset = symbol('etc_btc')
|
||||
context.asset = symbol('wings_eth')
|
||||
|
||||
|
||||
def handle_data(context, data):
|
||||
@@ -35,7 +35,7 @@ run_algorithm(
|
||||
initialize=initialize,
|
||||
handle_data=handle_data,
|
||||
analyze=None,
|
||||
exchange_name='poloniex',
|
||||
exchange_name='bittrex',
|
||||
algo_namespace='simple_loop',
|
||||
base_currency='btc'
|
||||
base_currency='eth'
|
||||
)
|
||||
|
||||
@@ -64,10 +64,13 @@ class ExchangeBundle:
|
||||
if path in self._readers and self._readers[path] is not None:
|
||||
return self._readers[path]
|
||||
|
||||
self._readers[path] = BcolzExchangeBarReader(
|
||||
rootdir=path,
|
||||
data_frequency=data_frequency
|
||||
)
|
||||
try:
|
||||
self._readers[path] = BcolzExchangeBarReader(
|
||||
rootdir=path,
|
||||
data_frequency=data_frequency
|
||||
)
|
||||
except IOError:
|
||||
self.get_readers[path] = None
|
||||
|
||||
return self._readers[path]
|
||||
|
||||
|
||||
@@ -76,16 +76,17 @@ class ExchangeBundleTestCase:
|
||||
pass
|
||||
|
||||
def test_merge_ctables(self):
|
||||
exchange_name = 'poloniex'
|
||||
exchange_name = 'bittrex'
|
||||
|
||||
# Switch between daily and minute for testing
|
||||
# data_frequency = 'daily'
|
||||
data_frequency = 'minute'
|
||||
data_frequency = 'daily'
|
||||
|
||||
exchange = get_exchange(exchange_name)
|
||||
assets = [
|
||||
exchange.get_asset('eth_btc'),
|
||||
exchange.get_asset('etc_btc'),
|
||||
exchange.get_asset('wings_eth'),
|
||||
]
|
||||
|
||||
start = pd.to_datetime('2017-9-1', utc=True)
|
||||
@@ -102,7 +103,7 @@ class ExchangeBundleTestCase:
|
||||
asset=asset,
|
||||
data_frequency=data_frequency,
|
||||
# period='2017-9',
|
||||
period='2017-9',
|
||||
period='2017',
|
||||
# Dont't forget to update if you change your dates
|
||||
start_dt=start,
|
||||
end_dt=end,
|
||||
@@ -116,7 +117,7 @@ class ExchangeBundleTestCase:
|
||||
# In minute mode, the data is there too. This signals that the minute
|
||||
# writer / reader is more powerful. This explains why I did not
|
||||
# encounter these problems as I have been focusing on minute data.
|
||||
reader = self.get_reader(data_frequency)
|
||||
reader = exchange_bundle.get_reader(data_frequency)
|
||||
for asset in assets:
|
||||
# Since this pair was loaded last. It should be there in daily mode.
|
||||
arrays = reader.load_raw_arrays(
|
||||
@@ -125,8 +126,8 @@ class ExchangeBundleTestCase:
|
||||
start_dt=start,
|
||||
end_dt=end
|
||||
)
|
||||
print('found {} rows for {} ingestion'.format(
|
||||
len(arrays[0]), asset.symbol)
|
||||
print('found {} rows for {} ingestion\n{}'.format(
|
||||
len(arrays[0]), asset.symbol, arrays[0])
|
||||
)
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user