From 5d3dcc3df496e94d2a696c1999474355382ada9a Mon Sep 17 00:00:00 2001 From: Jean Bredeche Date: Sat, 16 Apr 2016 21:39:55 -0400 Subject: [PATCH] PERF: do work later, when needed. --- zipline/data/data_portal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zipline/data/data_portal.py b/zipline/data/data_portal.py index c8127591..232f11e8 100644 --- a/zipline/data/data_portal.py +++ b/zipline/data/data_portal.py @@ -638,8 +638,6 @@ class DataPortal(object): return self._equity_daily_reader.get_last_traded_dt(asset, dt) def _check_extra_sources(self, asset, column, dt): - day = normalize_date(dt) - # If we have an extra source with a column called "price", only look # at it if it's on something like palladium and not AAPL (since our # own price data always wins when dealing with assets). @@ -647,6 +645,8 @@ class DataPortal(object): not (column in BASE_FIELDS and isinstance(asset, Asset)) if look_in_augmented_sources: + day = normalize_date(dt) + # we're being asked for a field in an extra source try: return self._augmented_sources_map[column][asset].\