mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 21:58:27 +08:00
OPEN cal start=2015-03-01, minor fixes for rc-0.1.dev7
This commit is contained in:
@@ -444,9 +444,6 @@ class TradingAlgorithm(object):
|
||||
'data frequency: {}'.format(data_frequency)
|
||||
)
|
||||
|
||||
print 'first_dates:', all_dates[:10]
|
||||
print 'last_dates:', all_dates[:-10]
|
||||
|
||||
self.engine = SimplePipelineEngine(
|
||||
get_loader,
|
||||
all_dates,
|
||||
|
||||
@@ -36,7 +36,7 @@ class PoloniexBundle(BaseCryptoPricingBundle):
|
||||
def frequencies(self):
|
||||
return set((
|
||||
'daily',
|
||||
'5-minute',
|
||||
#'5-minute',
|
||||
))
|
||||
|
||||
@lazyval
|
||||
|
||||
@@ -279,7 +279,7 @@ def ensure_crypto_benchmark_data(symbol,
|
||||
None,
|
||||
symbol,
|
||||
get_calendar(bundle.calendar_name),
|
||||
first_date,
|
||||
first_date - trading_day,
|
||||
last_date,
|
||||
'daily',
|
||||
)
|
||||
@@ -491,7 +491,7 @@ def _load_cached_data(filename, first_date, last_date, now, resource_name,
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
data = from_csv(path)
|
||||
data.index = pd.to_datetime(data.index).tz_localize('UTC')
|
||||
data.index = pd.to_datetime(data.index, infer_datetime_format=True, errors='coerce' ).tz_localize('UTC')
|
||||
if has_data_for_dates(data, first_date, last_date):
|
||||
return data
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ def choose_treasury(select_treasury, treasury_curves, start_session,
|
||||
)
|
||||
break
|
||||
|
||||
if search_day:
|
||||
if search_day and trading_calendar.name != 'OPEN': # Supress warning for 'OPEN' calendar
|
||||
if (search_dist is None or search_dist > 1) and \
|
||||
search_days[0] <= end_session <= search_days[-1]:
|
||||
message = "No rate within 1 trading day of end date = \
|
||||
|
||||
@@ -45,7 +45,7 @@ class CryptoPricingLoader(PipelineLoader):
|
||||
reader = bundle.five_minute_bar_reader
|
||||
all_sessions = cal.all_five_minutes
|
||||
|
||||
elif daily_bar_reader == 'minute':
|
||||
elif data_frequency == 'minute':
|
||||
reader = bundle.minute_bar_reader
|
||||
all_sessions = cal.all_minutes
|
||||
|
||||
|
||||
@@ -51,10 +51,7 @@ class BenchmarkSource(object):
|
||||
elif benchmark_returns is not None:
|
||||
daily_series = benchmark_returns[sessions[0]:sessions[-1]]
|
||||
|
||||
print 'BENCHMARK_RETURNS'
|
||||
|
||||
if self.emission_rate == "minute":
|
||||
print 'BENCHMARK_RETURNS minute'
|
||||
# we need to take the env's benchmark returns, which are daily,
|
||||
# and resample them to minute
|
||||
minutes = trading_calendar.minutes_for_sessions_in_range(
|
||||
@@ -69,7 +66,6 @@ class BenchmarkSource(object):
|
||||
|
||||
self._precalculated_series = minute_series
|
||||
elif self.emission_rate == '5-minute':
|
||||
print 'BENCHMARK_RETURNS 5-minute'
|
||||
five_minutes = \
|
||||
trading_calendar.five_minutes_for_sessions_in_range(
|
||||
sessions[0],
|
||||
@@ -83,7 +79,6 @@ class BenchmarkSource(object):
|
||||
|
||||
self._precalculated_series = five_minute_series
|
||||
else:
|
||||
print 'BENCHMARK_RETURNS daily'
|
||||
self._precalculated_series = daily_series
|
||||
else:
|
||||
raise Exception("Must provide either benchmark_asset or "
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from datetime import time
|
||||
from pytz import timezone
|
||||
|
||||
from pandas import Timestamp
|
||||
from pandas.tseries.offsets import DateOffset
|
||||
|
||||
from catalyst.utils.memoize import lazyval
|
||||
@@ -28,3 +29,6 @@ class OpenExchangeCalendar(TradingCalendar):
|
||||
@lazyval
|
||||
def day(self):
|
||||
return DateOffset(days=1)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(OpenExchangeCalendar, self).__init__(start=Timestamp('2015-03-01', tz='UTC'), **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user