mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-02 18:29:36 +08:00
Uses dictionary update instead of iterating through keys.
update_universe is a bottleneck on large data sets. A large portion of that bottleneck is the call to getitem while looping over the keys, so using update while passing along the internal __dict__ Seeing about a 40% improvement.
This commit is contained in:
@@ -241,8 +241,7 @@ class AlgorithmSimulator(object):
|
||||
self.algo.set_portfolio(event.portfolio)
|
||||
|
||||
# Update our knowledge of this event's sid
|
||||
for field in event.keys():
|
||||
self.universe[event.sid][field] = event[field]
|
||||
self.universe[event.sid].update(event.__dict__)
|
||||
|
||||
def simulate_snapshot(self, date):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user