MAINT: Rebase reconciliation

This commit is contained in:
jfkirk
2016-06-08 13:34:22 -04:00
committed by Jean Bredeche
parent 77cdec161a
commit 581e817603
5 changed files with 20 additions and 17 deletions
+8 -9
View File
@@ -45,7 +45,11 @@ from zipline.data.minute_bars import (
)
from zipline.utils.calendars import get_calendar
from zipline.testing.fixtures import WithTradingSchedule, ZiplineTestCase
from zipline.testing.fixtures import (
WithInstanceTmpDir,
WithTradingSchedule,
ZiplineTestCase,
)
# Calendar is set to cover several half days, to check a case where half
# days would be read out of order in cases of windows which spanned over
@@ -54,7 +58,8 @@ TEST_CALENDAR_START = Timestamp('2014-06-02', tz='UTC')
TEST_CALENDAR_STOP = Timestamp('2015-12-31', tz='UTC')
class BcolzMinuteBarTestCase(WithTradingSchedule, ZiplineTestCase):
class BcolzMinuteBarTestCase(WithTradingSchedule, WithInstanceTmpDir,
ZiplineTestCase):
@classmethod
def init_class_fixtures(cls):
@@ -67,16 +72,10 @@ class BcolzMinuteBarTestCase(WithTradingSchedule, ZiplineTestCase):
cls.test_calendar_start = cls.market_opens.index[0]
cls.test_calendar_stop = cls.market_opens.index[-1]
def dir_cleanup(self):
self.dir_.cleanup()
def init_instance_fixtures(self):
super(BcolzMinuteBarTestCase, self).init_instance_fixtures()
self.dir_ = TempDirectory()
self.dir_.create()
self.add_instance_callback(callback=self.dir_cleanup)
self.dest = self.dir_.getpath('minute_bars')
self.dest = self.instance_tmpdir.getpath('minute_bars')
os.makedirs(self.dest)
self.writer = BcolzMinuteBarWriter(
TEST_CALENDAR_START,
+4 -4
View File
@@ -1944,7 +1944,7 @@ class TestCapitalChanges(WithLogger,
@classmethod
def make_minute_bar_data(cls):
minutes = cls.env.minutes_for_days_in_range(
minutes = cls.trading_schedule.execution_minutes_for_days_in_range(
pd.Timestamp('2006-01-03', tz='UTC'),
pd.Timestamp('2006-01-09', tz='UTC')
)
@@ -1956,14 +1956,14 @@ class TestCapitalChanges(WithLogger,
[10000] * len(minutes),
timedelta(minutes=1),
cls.sim_params,
cls.env),
cls.trading_schedule),
},
index=pd.DatetimeIndex(minutes),
)
@classmethod
def make_daily_bar_data(cls):
days = cls.env.days_in_range(
days = cls.trading_schedule.execution_days_in_range(
pd.Timestamp('2006-01-03', tz='UTC'),
pd.Timestamp('2006-01-09', tz='UTC')
)
@@ -1975,7 +1975,7 @@ class TestCapitalChanges(WithLogger,
[10000] * len(days),
timedelta(days=1),
cls.sim_params,
cls.env),
cls.trading_schedule),
},
index=pd.DatetimeIndex(days),
)
+1 -1
View File
@@ -141,7 +141,7 @@ class CommissionAlgorithmTests(WithDataPortal, WithSimParams, ZiplineTestCase):
[100.0] * num_days,
timedelta(days=1),
cls.sim_params,
cls.env,
trading_schedule=cls.trading_schedule,
),
},
index=cls.sim_params.trading_days,
+4 -2
View File
@@ -2234,11 +2234,12 @@ shares in position"
[100, 100, 100, 100],
oneday,
self.sim_params,
env=self.env
trading_schedule=self.trading_schedule,
)
data_portal = create_data_portal_from_trade_history(
self.env,
self.trading_schedule,
self.instance_tmpdir,
self.sim_params,
{1: trades})
@@ -2278,11 +2279,12 @@ shares in position"
[100, 100, 100, 100],
oneday,
self.sim_params,
env=self.env
trading_schedule=self.trading_schedule,
)
data_portal = create_data_portal_from_trade_history(
self.env,
self.trading_schedule,
self.instance_tmpdir,
self.sim_params,
{1: trades})
+3 -1
View File
@@ -215,7 +215,9 @@ class AlgorithmSimulator(object):
# perspective as we have technically not "advanced" to the
# current dt yet.
algo.perf_tracker.position_tracker.sync_last_sale_prices(
self.env.previous_market_minute(dt),
self.algo.trading_schedule.previous_execution_minute(
dt
),
False,
self.data_portal
)