mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 12:19:43 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user