Skip to content

Commit

Permalink
API: run Alphalens with returns instead of prices (utils.get_clean_fa…
Browse files Browse the repository at this point in the history
…ctor)

Issue #270

* refactored compute_forward_returns and get_clean_factor_and_forward_returns
* added get_clean_factor
* fix bug in compute_factor_returns: call infer_trading_calendar before factor index is changed
  • Loading branch information
HereticSK authored and luca-s committed Mar 14, 2018
1 parent 2143a38 commit efcc69c
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 89 deletions.
3 changes: 2 additions & 1 deletion alphalens/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ def test_compute_forward_returns(self):
dr = date_range(start='2015-1-1', end='2015-1-3')
prices = DataFrame(index=dr, columns=['A', 'B'],
data=[[1, 1], [1, 2], [2, 1]])
factor = prices.stack()

fp = compute_forward_returns(prices.index, prices, periods=[1, 2])
fp = compute_forward_returns(factor, prices, periods=[1, 2])

ix = MultiIndex.from_product([dr, ['A', 'B']],
names=['date', 'asset'])
Expand Down
Loading

0 comments on commit efcc69c

Please sign in to comment.