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

Cumulative Performance in reports.html does not calculate correctly #343

Open
manuelwithbmw opened this issue Apr 2, 2024 · 4 comments
Open

Comments

@manuelwithbmw
Copy link

manuelwithbmw commented Apr 2, 2024

Hello - It seems to me that the Cumulative Performance in reports.html does not calculate correctly possibly since the point in time where the Strategy performance goes (incidentally) negative - the Sharpe ratio calculation seems okay overall, but if I use the qs.reports.html method as below:

qs.reports.html(returns_df.sharpe, "SPY", rf=0.000066, output = "..path../Strategy Tearsheets/strategy_report.html")

the Cumulative Performance calculation does not adds up correctly, it overestimates my manual calculations. The reports shows 106.83% while I have 84.97% (easily verifiable in my excel file). I made some simulations and it seems the problem arises since the Strategy goes negative, when it goes up, the Report.html overestimate it

Screenshot 2024-04-02 at 11 10 10

Also - it would be nice to know how the risk free has to be entered (here I set rf rate = 0.000066 (shown in the chart as 0.01%), for a 10Y Treasury at 4.25%, is that correct?). I am using 0.000066 as the RF 10Y US Daily Return with a 10Y Treasury at 4.25% should be 0.0066% (formula I am using I Excel is =(POWER((1+4.25),(1/252))-1)/100)

Thank you

@GOATsann
Copy link

GOATsann commented Apr 8, 2024

Bump

@DannyMartens
Copy link

Try this:
qs.reports.html(returns_df.sharpe, "SPY", rf=0.000066, output = "..path../Strategy Tearsheets/strategy_report.html", compunded=False)

Note also that some others are now maintaining @ https://github.com/Lumiwealth/quantstats_lumi

@manuelwithbmw
Copy link
Author

manuelwithbmw commented Apr 20, 2024

Thank you @DannyMartens - the compound = False has not changed much.

I have also tried installing quantstats_lumi as well and I am comparing the results with quantstats.
I can see for now that Lumi overestimates (circa 10%) the Sharpe Ratio of the other library quantstats - anyway I seem to understand the Lumi version is better maintained? Anyway, this difference does not bother me too much

Can you please let me know what is the right way of entering the Risk Free value in the report.html?
If we have a US 10 yrs at 4.61% as of now, in the html.report function I am using the Avg RF Daily Returns which according to my calculations (for my time window of observation) would be 0.000066, so I am entering 0.000066 as below:

qs.reports.html(returns_df.sharpe, "SPY", rf=0.000066, output = "/Users/.../Strategy Tearsheets/strategy_report.html")

Is this the right way to use RF rate here?

@lorisn
Copy link

lorisn commented Apr 28, 2024

I also changed to use https://github.com/Lumiwealth/quantstats_lumi
No all problems i had with the original library are fixed, check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants