mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-11 06:54:36 +08:00
Fixed small issue with minute ingestion
This commit is contained in:
@@ -453,8 +453,12 @@ class ExchangeBundle:
|
||||
frequency=data_frequency
|
||||
)
|
||||
|
||||
# Currencies don't always start trading at midnight.
|
||||
# Checking the last minute of the day instead.
|
||||
range_start = period_start.replace(hour=23, minute=59) \
|
||||
if data_frequency == 'minute' else period_start
|
||||
has_data = range_in_bundle(
|
||||
asset, period_start, period_end, reader
|
||||
asset, range_start, period_end, reader
|
||||
)
|
||||
|
||||
if not has_data:
|
||||
|
||||
@@ -17,24 +17,41 @@ log = Logger('test_exchange_bundle')
|
||||
|
||||
class ExchangeBundleTestCase:
|
||||
def test_ingest_minute(self):
|
||||
data_frequency = 'minute'
|
||||
exchange_name = 'bitfinex'
|
||||
|
||||
# start = pd.to_datetime('2017-09-01', utc=True)
|
||||
start = pd.to_datetime('2017-9-1', utc=True)
|
||||
end = pd.to_datetime('2017-9-30', utc=True)
|
||||
exchange = get_exchange(exchange_name)
|
||||
exchange_bundle = ExchangeBundle(exchange)
|
||||
assets = [
|
||||
exchange.get_asset('neo_eth')
|
||||
]
|
||||
|
||||
exchange_bundle = ExchangeBundle(get_exchange(exchange_name))
|
||||
# start = pd.to_datetime('2017-09-01', utc=True)
|
||||
start = pd.to_datetime('2017-9-15', utc=True)
|
||||
end = pd.to_datetime('2017-9-30', utc=True)
|
||||
|
||||
log.info('ingesting exchange bundle {}'.format(exchange_name))
|
||||
exchange_bundle.ingest(
|
||||
data_frequency='minute',
|
||||
include_symbols='neo_eth',
|
||||
data_frequency=data_frequency,
|
||||
include_symbols=','.join([asset.symbol for asset in assets]),
|
||||
# include_symbols=None,
|
||||
exclude_symbols=None,
|
||||
start=start,
|
||||
end=end,
|
||||
show_progress=True
|
||||
)
|
||||
|
||||
reader = exchange_bundle.get_reader(data_frequency)
|
||||
for asset in assets:
|
||||
arrays = reader.load_raw_arrays(
|
||||
sids=[asset.sid],
|
||||
fields=['close'],
|
||||
start_dt=start,
|
||||
end_dt=end
|
||||
)
|
||||
print('found {} rows for {} ingestion\n{}'.format(
|
||||
len(arrays[0]), asset.symbol, arrays[0])
|
||||
)
|
||||
pass
|
||||
|
||||
def test_ingest_minute_all(self):
|
||||
|
||||
Reference in New Issue
Block a user