mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-12 11:50:11 +08:00
ENH: Make RollingPanel update itself if new fields arrive.
Before we preinitialized the BT's fields and sids. Thus, no new ones could be added after initialization. This should be fixed now.
This commit is contained in:
committed by
Eddie Hebert
parent
33c23af503
commit
236fe92a53
@@ -43,7 +43,7 @@ def return_price(data):
|
||||
|
||||
|
||||
class BatchTransformAlgorithmSetSid(TradingAlgorithm):
|
||||
def initialize(self, sids):
|
||||
def initialize(self, sids=None):
|
||||
self.history = []
|
||||
|
||||
self.batch_transform = return_price(
|
||||
@@ -111,15 +111,14 @@ class TestChangeOfSids(TestCase):
|
||||
)
|
||||
|
||||
def test_all_sids_passed(self):
|
||||
algo = BatchTransformAlgorithmSetSid(self.sids,
|
||||
sim_params=self.sim_params)
|
||||
algo = BatchTransformAlgorithmSetSid(sim_params=self.sim_params)
|
||||
source = DifferentSidSource()
|
||||
algo.run(source)
|
||||
for df, date in zip(algo.history, source.trading_days):
|
||||
for i, (df, date) in enumerate(zip(algo.history, source.trading_days)):
|
||||
self.assertEqual(df.index[-1], date, "Newest event doesn't \
|
||||
match.")
|
||||
|
||||
for sid in self.sids:
|
||||
for sid in self.sids[:i]:
|
||||
self.assertIn(sid, df.columns)
|
||||
|
||||
last_elem = len(df) - 1
|
||||
|
||||
Reference in New Issue
Block a user