mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-09 11:50:09 +08:00
PERF: Remove alias_dt transform in favor of property on SIDData.
Adding a copy of the Event's dt field as datetime via the `alias_dt` generator, so that the API was forgiving and allowed both datetime and dt on a SIDData object, was creating noticeable overhead, even on an noop algorithms. Instead of incurring the cost of copying the datetime value and assigning it to the Event object on every event that is passed through the system, add a property to SIDData which acts as an alias `datetime` to `dt`. Eventually support for `data['foo'].datetime` may be removed, and could be considered deprecated.
This commit is contained in:
@@ -51,7 +51,6 @@ from zipline.protocol import Event
|
||||
from zipline.gens.composites import (
|
||||
date_sorted_sources,
|
||||
sequential_transforms,
|
||||
alias_dt
|
||||
)
|
||||
from zipline.gens.tradesimulation import AlgorithmSimulator
|
||||
|
||||
@@ -263,10 +262,9 @@ class TradingAlgorithm(object):
|
||||
|
||||
with_tnfms = sequential_transforms(date_sorted,
|
||||
*self.transforms)
|
||||
with_alias_dt = alias_dt(with_tnfms)
|
||||
|
||||
with_benchmarks = date_sorted_sources(benchmark_return_source,
|
||||
with_alias_dt)
|
||||
with_tnfms)
|
||||
|
||||
# Group together events with the same dt field. This depends on the
|
||||
# events already being sorted.
|
||||
|
||||
Reference in New Issue
Block a user