mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-08 19:10:47 +08:00
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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user