Skip to content

Commit

Permalink
ENH: improve error message if prices and signals do not match
Browse files Browse the repository at this point in the history
Issue #282
  • Loading branch information
luca-s committed Feb 28, 2018
1 parent 5dac300 commit 969153a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions alphalens/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ def compute_forward_returns(factor_idx,

factor_idx = factor_idx.intersection(prices.index)

if len(factor_idx) == 0:
raise ValueError("Factor and prices indices don't match: make sure "
"they have the same convention in terms of datetimes "
"and symbol-names")

forward_returns = pd.DataFrame(index=pd.MultiIndex.from_product(
[factor_idx, prices.columns], names=['date', 'asset']))

Expand Down

0 comments on commit 969153a

Please sign in to comment.