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:
Eddie Hebert
2014-03-07 10:55:59 -05:00
parent 778da20468
commit a203f69635
5 changed files with 19 additions and 16 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ class RecordDateSlippage(slippage.FixedSlippage):
self.latest_date = None
def simulate(self, event, open_orders):
self.latest_date = event['datetime']
self.latest_date = event.dt
result = super(RecordDateSlippage, self).simulate(event, open_orders)
return result