mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 02:54:16 +08:00
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:
@@ -22,11 +22,11 @@ class NoDataOnDate(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NoDataBeforeDate(Exception):
|
||||
class NoDataBeforeDate(NoDataOnDate):
|
||||
pass
|
||||
|
||||
|
||||
class NoDataAfterDate(Exception):
|
||||
class NoDataAfterDate(NoDataOnDate):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user