mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-10 13:15:00 +08:00
TST: Added tests for new order methods.
This commit is contained in:
+21
-7
@@ -21,7 +21,13 @@ from zipline.utils.test_utils import setup_logger
|
||||
import zipline.utils.factory as factory
|
||||
from zipline.test_algorithms import (TestRegisterTransformAlgorithm,
|
||||
RecordAlgorithm,
|
||||
TestOrderAlgorithm)
|
||||
TestOrderAlgorithm,
|
||||
TestOrderValueAlgorithm,
|
||||
TestTargetAlgorithm,
|
||||
TestOrderPercentAlgorithm,
|
||||
TestTargetPercentAlgorithm,
|
||||
TestTargetValueAlgorithm)
|
||||
|
||||
from zipline.sources import (SpecificEquityTrades,
|
||||
DataFrameSource,
|
||||
DataPanelSource)
|
||||
@@ -166,9 +172,17 @@ class TestTransformAlgorithm(TestCase):
|
||||
self.assertEqual(algo.data_frequency, 'minute')
|
||||
self.assertEqual(algo.annualizer, 10)
|
||||
|
||||
def test_orders_executed(self):
|
||||
algo = TestOrderAlgorithm(
|
||||
sim_params=self.sim_params,
|
||||
data_frequency='daily'
|
||||
)
|
||||
algo.run(self.df)
|
||||
def test_order_methods(self):
|
||||
AlgoClasses = [TestOrderAlgorithm,
|
||||
TestOrderValueAlgorithm,
|
||||
TestTargetAlgorithm,
|
||||
TestOrderPercentAlgorithm,
|
||||
TestTargetPercentAlgorithm,
|
||||
TestTargetValueAlgorithm]
|
||||
|
||||
for AlgoClass in AlgoClasses:
|
||||
algo = AlgoClass(
|
||||
sim_params=self.sim_params,
|
||||
data_frequency='daily'
|
||||
)
|
||||
algo.run(self.df)
|
||||
|
||||
Reference in New Issue
Block a user