Skip to content

BUG: Catch all missing data exceptions when computing dividend ratios #1507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions zipline/data/bar_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class NoDataOnDate(Exception):
pass


class NoDataBeforeDate(Exception):
class NoDataBeforeDate(NoDataOnDate):
pass


class NoDataAfterDate(Exception):
class NoDataAfterDate(NoDataOnDate):
pass


Expand Down
6 changes: 3 additions & 3 deletions zipline/data/us_equity_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,15 +634,15 @@ def get_last_traded_dt(self, asset, day):
while True:
try:
ix = self.sid_day_index(asset, search_day)
except NoDataOnDate:
return None
except NoDataBeforeDate:
return None
except NoDataAfterDate:
prev_day_ix = self.sessions.get_loc(search_day) - 1
if prev_day_ix > -1:
search_day = self.sessions[prev_day_ix]
continue
except NoDataOnDate:
return None
if volumes[ix] != 0:
return search_day
prev_day_ix = self.sessions.get_loc(search_day) - 1
Expand Down Expand Up @@ -965,7 +965,7 @@ def calc_dividend_ratios(self, dividends):
dtype=[
('sid', uint32),
('effective_date', uint32),
('ratio', float64),
('ratio', float64),
],
))
ex_dates = dividends.ex_date.values
Expand Down