BUG: Makes NoData{Before, After}Date subclass NoDataOnDate (#1507)

This allows us to catch and handle all three of these exceptions in
`calc_dividend_ratios`.
This commit is contained in:
Andrew Daniels
2016-09-22 11:43:43 -04:00
committed by GitHub
parent a5c7e93540
commit f1919dc3af
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -22,11 +22,11 @@ class NoDataOnDate(Exception):
pass
class NoDataBeforeDate(Exception):
class NoDataBeforeDate(NoDataOnDate):
pass
class NoDataAfterDate(Exception):
class NoDataAfterDate(NoDataOnDate):
pass
+3 -3
View File
@@ -634,8 +634,6 @@ class BcolzDailyBarReader(SessionBarReader):
while True:
try:
ix = self.sid_day_index(asset, search_day)
except NoDataOnDate:
return None
except NoDataBeforeDate:
return None
except NoDataAfterDate:
@@ -643,6 +641,8 @@ class BcolzDailyBarReader(SessionBarReader):
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
@@ -965,7 +965,7 @@ class SQLiteAdjustmentWriter(object):
dtype=[
('sid', uint32),
('effective_date', uint32),
('ratio', float64),
('ratio', float64),
],
))
ex_dates = dividends.ex_date.values