ENH: add point in time aspect to equity symbol mapping

Changes the overlap behavior so that it is an error to write data which
would have two companies holding the same ticker. Other than one test
around which company would win in that case, all the other tests are
passing. That single test has been changed to check the write-time
error.
This commit is contained in:
Joe Jevnik
2016-07-26 13:34:58 -04:00
parent 54be3858ba
commit 7fd8c29880
15 changed files with 1107 additions and 580 deletions
+9 -1
View File
@@ -777,7 +777,10 @@ class TestTransformAlgorithm(WithLogger,
@classmethod
def make_futures_info(cls):
return pd.DataFrame.from_dict({3: {'multiplier': 10}}, 'index')
return pd.DataFrame.from_dict(
{3: {'multiplier': 10, 'symbol': 'F'}},
orient='index',
)
@classmethod
def make_equity_daily_bar_data(cls):
@@ -985,6 +988,7 @@ def before_trading_start(context, data):
'start_date': start_session,
'end_date': period_end + timedelta(days=1)
}] * 2)
equities['symbol'] = ['A', 'B']
with TempDirectory() as tempdir, \
tmp_trading_env(equities=equities) as env:
sim_params = SimulationParameters(
@@ -2813,6 +2817,7 @@ class TestTradingControls(WithSimParams, WithDataPortal, ZiplineTestCase):
metadata = pd.DataFrame.from_dict(
{
1: {
'symbol': 'SYM',
'start_date': start,
'end_date': start + timedelta(days=6)
},
@@ -2940,6 +2945,7 @@ class TestTradingControls(WithSimParams, WithDataPortal, ZiplineTestCase):
def test_asset_date_bounds(self):
metadata = pd.DataFrame([{
'symbol': 'SYM',
'start_date': self.sim_params.start_session,
'end_date': '2020-01-01',
}])
@@ -2959,6 +2965,7 @@ class TestTradingControls(WithSimParams, WithDataPortal, ZiplineTestCase):
algo.run(data_portal)
metadata = pd.DataFrame([{
'symbol': 'SYM',
'start_date': '1989-01-01',
'end_date': '1990-01-01',
}])
@@ -2979,6 +2986,7 @@ class TestTradingControls(WithSimParams, WithDataPortal, ZiplineTestCase):
algo.run(data_portal)
metadata = pd.DataFrame([{
'symbol': 'SYM',
'start_date': '2020-01-01',
'end_date': '2021-01-01',
}])