From 7ae370b0378205a88302696ae6ce717e3553eaf7 Mon Sep 17 00:00:00 2001 From: Andrew Daniels Date: Mon, 20 Jun 2016 10:34:18 -0400 Subject: [PATCH] MAINT: Fixes DataPortal.get_spot_value to correctly handle 'price' field Querying for the price field of an equity actually looks at the close field, so we should do the same for futures. Otherwise `data.can_trade` and `data.current` of 'price' fail for futures. --- zipline/data/data_portal.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zipline/data/data_portal.py b/zipline/data/data_portal.py index f76e5253..3ef6cca7 100644 --- a/zipline/data/data_portal.py +++ b/zipline/data/data_portal.py @@ -787,8 +787,12 @@ class DataPortal(object): return self._get_daily_data(asset, field, day_to_use) else: if isinstance(asset, Future): - return self._get_minute_spot_value_future( - asset, field, dt) + if field == "price": + return self._get_minute_spot_value_future( + asset, "close", dt) + else: + return self._get_minute_spot_value_future( + asset, field, dt) else: if field == "last_traded": return self._equity_minute_reader.get_last_traded_dt(