mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-05 08:46:15 +08:00
PERF: re-ordered if statements, made into exclusive checks
This commit is contained in:
@@ -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