mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-03 12:20:37 +08:00
PERF: re-ordered if statements, made into exclusive checks
This commit is contained in:
1 parent
9b22b86703
commit
923d3e4cbc
1 file changed
+11
-6
@@ -128,16 +128,21 @@ class AlgorithmSimulator(object):
|
||||
events = []
|
||||
|
||||
for event in snapshot:
|
||||
if event.type == DATASOURCE_TYPE.SPLIT:
|
||||
self.algo.blotter.process_split(event)
|
||||
|
||||
if event.type in (DATASOURCE_TYPE.TRADE,
|
||||
DATASOURCE_TYPE.CUSTOM):
|
||||
if event.type == DATASOURCE_TYPE.TRADE:
|
||||
self.update_universe(event)
|
||||
updated = True
|
||||
if event.type == DATASOURCE_TYPE.BENCHMARK:
|
||||
|
||||
elif event.type == DATASOURCE_TYPE.BENCHMARK:
|
||||
self.algo.set_datetime(event.dt)
|
||||
bm_updated = True
|
||||
|
||||
elif event.type == DATASOURCE_TYPE.CUSTOM:
|
||||
self.update_universe(event)
|
||||
updated = True
|
||||
|
||||
elif event.type == DATASOURCE_TYPE.SPLIT:
|
||||
self.algo.blotter.process_split(event)
|
||||
|
||||
# If we are instantly filling orders we process
|
||||
# them after handle_data().
|
||||
if not self.algo.instant_fill:
|
||||
|
||||
Reference in new issue
Block a user