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

annual_returns calculation for 'calender' style is not accurate #212

Closed
justinlent opened this issue Nov 17, 2015 · 7 comments
Closed

annual_returns calculation for 'calender' style is not accurate #212

justinlent opened this issue Nov 17, 2015 · 7 comments
Assignees

Comments

@justinlent
Copy link
Contributor

I don't believe it computes the average annual return correctly since it currently just divides by num_years, where it should be computing the geometric return along the lines of:

total_return = (portfolio_end_value - portfolio_start_value) / portfolio_start_value
annual_return = (1+total_return) ^ (1/num_years) - 1

@twiecki Thoughts?

@justinlent
Copy link
Contributor Author

which is just the CAGR (compounded annual growth rate) calculation, so maybe we should change the method name from calendar -> CAGR. Looks like folks in the Q forums refer to this method using CAGR. As well the annual return from CAGR is the same as "compound" which I somewhat proved to myself in an Excel spreadsheet, so having this style may just be redundant unless I'm missing an edge case or something.

@twiecki
Copy link
Contributor

twiecki commented Nov 18, 2015

We're on the same page and should fix that asap.

@justinlent
Copy link
Contributor Author

my current working opinion is we should simplify annual_return to simply be CAGR, so change the signature from:

def annual_return(returns, style='compound', period=DAILY)

to
def annual_return(returns, period=DAILY)

and then only have it return the CAGR result which is the fixed version of 'calendar' as described earlier in this thread.

I checked and none of the other downstream performance stats depend on annual_return, since stats like Sharpe Ratio have been refactored to compute the returns in such a fashion as needed locally for themselves

@twiecki
Copy link
Contributor

twiecki commented Dec 1, 2015

I agree with that.

@twiecki
Copy link
Contributor

twiecki commented Dec 2, 2015

Assigning to you as you worked most closely with this.

@justinlent
Copy link
Contributor Author

@twiecki can you do a quick code review of my implementation in this PR #234

@twiecki
Copy link
Contributor

twiecki commented Dec 17, 2015

Closed via #234

@twiecki twiecki closed this as completed Dec 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants