mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-01 07:25:26 +08:00
MAINT: Handle gaps in input to daily bars writer (#1778)
Previously, a dataframe passed into BcolzDailyBarWriter.write that was missing an expected session between its first and last sessions would be written incorrectly. Upon converting the dataframe to a ctable, the values for all days following the gap would be shifted backwards, and nans would be shifted in at the end. This commit handles the issue by asserting that the number of rows in the input table matches the number of sessions in the calendar between the table's first and last sessions. Also fixes a test that was mistakenly using minutes_in_range where it should have been using sessions_in_range (uncovered by this change).
This commit is contained in:
@@ -2261,7 +2261,7 @@ class TestCapitalChanges(WithLogger,
|
||||
|
||||
@classmethod
|
||||
def make_equity_daily_bar_data(cls):
|
||||
days = cls.trading_calendar.minutes_in_range(
|
||||
days = cls.trading_calendar.sessions_in_range(
|
||||
pd.Timestamp('2006-01-03', tz='UTC'),
|
||||
pd.Timestamp('2006-01-09', tz='UTC')
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user