ENH: Add style parameters to order API helper methods.

Add `style` parameter to order_value, order_percent, order_target,
order_target_percent, and order_target_value methods.  The style parameter is
forwarded to the underlying call to `order`.
This commit is contained in:
Scott Sanderson
2014-04-17 14:26:36 -04:00
parent 119a1a4cda
commit f1fafc34ce
3 changed files with 89 additions and 14 deletions
+19
View File
@@ -26,6 +26,7 @@ import zipline.utils.simfactory as simfactory
from zipline.test_algorithms import (TestRegisterTransformAlgorithm,
RecordAlgorithm,
TestOrderAlgorithm,
TestOrderStyleForwardingAlgorithm,
TestOrderInstantAlgorithm,
TestOrderValueAlgorithm,
TestTargetAlgorithm,
@@ -211,6 +212,24 @@ class TestTransformAlgorithm(TestCase):
)
algo.run(self.df)
def test_order_method_style_forwarding(self):
method_names_to_test = ['order',
'order_value',
'order_percent',
'order_target',
'order_target_percent',
'order_target_value']
for name in method_names_to_test:
algo = TestOrderStyleForwardingAlgorithm(
sim_params=self.sim_params,
data_frequency='daily',
instant_fill=False,
method_name=name
)
algo.run(self.df)
def test_order_instant(self):
algo = TestOrderInstantAlgorithm(sim_params=self.sim_params,
data_frequency='daily',