Skip to content

Commit

Permalink
MAINT: improve error message in pipeline engine for misaligned dates
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Jevnik authored and llllllllll committed Mar 29, 2018
1 parent 27e6abc commit 8289d59
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions zipline/pipeline/engine.py
Original file line number Diff line number Diff line change
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

0 comments on commit 8289d59

Please sign in to comment.