Skip to content

Commit

Permalink
MAINT: Fixes DataPortal.get_spot_value to correctly handle 'price' field
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Andrew Daniels committed Jun 20, 2016
1 parent 9f02f14 commit 7ae370b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zipline/data/data_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,12 @@ def get_spot_value(self, asset, field, dt, data_frequency):
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(
Expand Down

0 comments on commit 7ae370b

Please sign in to comment.