mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-27 20:20:55 +08:00
Fixed an issue with the backtest get_history_window method.
This commit is contained in:
@@ -7,7 +7,7 @@ from catalyst.api import symbol
|
||||
|
||||
def initialize(context):
|
||||
print('initializing')
|
||||
context.asset = symbol('wings_eth')
|
||||
context.asset = symbol('etc_eth')
|
||||
|
||||
|
||||
def handle_data(context, data):
|
||||
@@ -35,7 +35,7 @@ run_algorithm(
|
||||
initialize=initialize,
|
||||
handle_data=handle_data,
|
||||
analyze=None,
|
||||
exchange_name='bittrex',
|
||||
exchange_name='poloniex',
|
||||
algo_namespace='simple_loop',
|
||||
base_currency='eth'
|
||||
)
|
||||
|
||||
@@ -24,7 +24,8 @@ from catalyst.exchange.exchange_errors import (
|
||||
ExchangeRequestError,
|
||||
ExchangeBarDataError,
|
||||
PricingDataBeforeTradingError,
|
||||
PricingDataNotLoadedError, InvalidHistoryFrequencyError)
|
||||
PricingDataNotLoadedError, InvalidHistoryFrequencyError,
|
||||
BundleNotFoundError)
|
||||
|
||||
log = Logger('DataPortalExchange')
|
||||
|
||||
@@ -297,13 +298,19 @@ class DataPortalExchangeBacktest(DataPortalExchangeBase):
|
||||
else:
|
||||
raise InvalidHistoryFrequencyError(frequency=data_frequency)
|
||||
|
||||
reader = bundle.get_reader(data_frequency)
|
||||
if reader is None:
|
||||
raise BundleNotFoundError(
|
||||
exchange=exchange.name,
|
||||
data_frequency=data_frequency
|
||||
)
|
||||
|
||||
try:
|
||||
values = bundle.get_raw_arrays(
|
||||
assets=assets,
|
||||
values = reader.load_raw_arrays(
|
||||
sids=[asset.sid for asset in assets],
|
||||
fields=[field],
|
||||
start_dt=dts[0],
|
||||
end_dt=dts[-1],
|
||||
data_frequency=data_frequency
|
||||
end_dt=dts[-1]
|
||||
)[0]
|
||||
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user