Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: improve error message in pipeline engine for misaligned dates #2131

Merged
merged 1 commit into from Mar 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions zipline/pipeline/engine.py
Expand Up @@ -379,8 +379,19 @@ def _compute_root_mask(self, start_date, end_date, extra_rows):
include_start_date=False
)

assert lifetimes.index[extra_rows] == start_date
assert lifetimes.index[-1] == end_date
if lifetimes.index[extra_rows] != start_date:
raise ValueError(
'The first date of the lifetimes matrix does not match the'
' start date of the pipeline. Did you forget to align the'
' start_date to the trading calendar?'
)
if lifetimes.index[-1] != end_date:
raise ValueError(
'The last date of the lifetimes matrix does not match the'
' start date of the pipeline. Did you forget to align the'
' end_date to the trading calendar?'
)

if not lifetimes.columns.unique:
columns = lifetimes.columns
duplicated = columns[columns.duplicated()].unique()
Expand Down