MAINT: Raise when trying to get a date outside trading calendar

next_scheduled_day and previous_scheduled day should raise if
trying a return a date outside the calendar. Previously it just
returns None, but it should be made consistent with the behavior
of add_scheduled_days
This commit is contained in:
Andrew Liang
2016-06-10 17:37:08 -04:00
parent c83414e152
commit 28b1da443e
+2 -2
View File
@@ -73,7 +73,7 @@ def next_scheduled_day(date, last_trading_day, is_scheduled_day_hook):
dt += delta
if is_scheduled_day_hook(dt):
return dt
return None
raise NoFurtherDataError(msg='Cannot find next day after %s' % date)
def previous_scheduled_day(date, first_trading_day, is_scheduled_day_hook):
@@ -97,7 +97,7 @@ def previous_scheduled_day(date, first_trading_day, is_scheduled_day_hook):
dt += delta
if is_scheduled_day_hook(dt):
return dt
return None
raise NoFurtherDataError(msg='Cannot find previous day before %s' % date)
def next_open_and_close(date, open_and_close_hook,