mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-11 11:16:15 +08:00
TST: add unittest for CLOSE_POSTION event type for futures, add commission to TestAlgorithm
This commit is contained in:
@@ -1290,7 +1290,6 @@ class TestAccountControls(TestCase):
|
||||
algo = SetMaxLeverageAlgorithm(1)
|
||||
self.check_algo_succeeds(algo, handle_data)
|
||||
|
||||
|
||||
class TestClosePosAlgo(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@@ -1303,10 +1302,15 @@ class TestClosePosAlgo(TestCase):
|
||||
DATASOURCE_TYPE.CLOSE_POSITION]},
|
||||
index=self.index)
|
||||
})
|
||||
|
||||
self.data = DataPanelSource(pan)
|
||||
|
||||
metadata = {1: {'symbol': 'TEST',
|
||||
'asset_type': 'future',
|
||||
'notice_date': days[2],
|
||||
'expiration_date': days[3]}}
|
||||
self.algo = TestAlgorithm(sid=1, amount=1, order_count=1,
|
||||
instant_fill=True, commission=PerShare(0))
|
||||
instant_fill=True, commission=PerShare(0),
|
||||
asset_metadata=metadata)
|
||||
self.results = self.run_algo()
|
||||
self.expected_positions = [1, 1, 0]
|
||||
self.expected_pnl = [0, 1, 2]
|
||||
|
||||
Reference in New Issue
Block a user