mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-18 12:20:12 +08:00
Instead of checking the positions indexes every time either `_position_amounts` or `_position_last_sale_prices` is updated, check and grow the individual Series on each update. This gain with this patch is by reducing the following bottlenecks: - Checking both vectors when only one is updated. - Using try/except to trigger the growth, instead of incurring the cost of checking the Index contains on every update. In testing this change results in about a 33% speedup of the `update_last_sale` algorithm when run with a buy and hold algorithm with 160 equities, resulting in a 20% speedup overall.