quantopian / alphalens

Performance analysis of predictive (alpha) stock factors
http://quantopian.github.io/alphalens
Apache License 2.0
3.2k stars 1.12k forks source link

bug? in utils.py #331

Closed woshihaofeng closed 5 years ago

woshihaofeng commented 5 years ago

in utils.py , function: compute_forward_returns() entries_to_test = min( 30, len(forward_returns.index) - period,

when len(prices.index) = 50 ,len(forward_returns.index)=30, and have the same last date. period=1, end = prices.index[p_idx + period] index will out of bounds,

        #len(forward_returns.index), 
        len(prices.index) - period

)

luca-s commented 5 years ago

I guess you are right, thanks for reporting this.

luca-s commented 5 years ago

@woshihaofeng Would you like to submit a PR?

woshihaofeng commented 5 years ago

just get it when testing example "event_study_synthetic_data.ipynb"

luca-s commented 5 years ago

@woshihaofeng could you tell me what Alphalens, pandas and numpy versions are you using?

woshihaofeng commented 5 years ago

sure. Alphalens is 0.3.6, pandas is 0.23.4, numpy is 1.15.4

luca-s commented 5 years ago

I am not getting any error when running "event_study_synthetic_data.ipynb". Did you modify the input data in the example?If so, could you tell me how to reproduce the error you are seeing?