refactoring of algorithm to make it work for both batch style run method, and generator style consumption. removed the portfolio property from the data parameter. added set_slippage and set_commission methods to algorithm. removed timeout tracking.

This commit is contained in:
fawce
2012-10-10 16:06:32 -04:00
committed by Eddie Hebert
parent d2e639c2da
commit 16b0d71506
15 changed files with 228 additions and 411 deletions
+3 -2
View File
@@ -32,6 +32,7 @@ from zipline.gens.stddev import MovingStandardDev
from zipline.gens.returns import Returns
import zipline.utils.factory as factory
from zipline.test_algorithms import BatchTransformAlgorithm
@@ -315,7 +316,7 @@ class BatchTransformTestCase(TestCase):
self.source, self.df = factory.create_test_df_source()
def test_event_window(self):
algo = BatchTransformAlgorithm(sids=[0, 1])
algo = BatchTransformAlgorithm()
algo.run(self.source)
self.assertEqual(algo.history_return_price_class[:2],
@@ -344,7 +345,7 @@ class BatchTransformTestCase(TestCase):
)
def test_passing_of_args(self):
algo = BatchTransformAlgorithm([0, 1], 1, kwarg='str')
algo = BatchTransformAlgorithm(1, kwarg='str')
self.assertEqual(algo.args, (1,))
self.assertEqual(algo.kwargs, {'kwarg': 'str'})