Skip to content

Sharpe/Sortino period needs to be 252 for financial markets #30

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

Open
Koha101 opened this issue Apr 23, 2024 · 3 comments
Open

Sharpe/Sortino period needs to be 252 for financial markets #30

Koha101 opened this issue Apr 23, 2024 · 3 comments

Comments

@Koha101
Copy link

Koha101 commented Apr 23, 2024

The period has been changed from 252 in quantstats to 365 in quanstats_lumi, to correct the CAGR calculation, since it uses calendar days in its calculation. This breaks the sharpe and sortino calculations, since they use the sqrt(period), which should be the number of trading days, not calendar days, 252 for financial markets. The 365 number works for crypto, since that's available 365 days/year.

I propose the default should be 252 for sharpe and sortino, and 365 for CAGR. Additionally, it would be worth having 2 separate periods in reports.py, calendar_period and trading_period, to use the correct one on calls to the metrics, and expose the two periods in calls like reports.html().

@grzesir
Copy link
Contributor

grzesir commented Apr 23, 2024 via email

@jakewillms17
Copy link

I disagree with using 365 and 252 like this. Very simple fix for CAGR would be to just count the len(returns) to gather the number of days as opposed to the calendar calculation. Makes more sense IMO to standardize 252 as we are dealing with financial data.

@jiema
Copy link

jiema commented Sep 5, 2024

252 is correct imo, and 365 is wrong. unless you are working with an asset traded 24/7 like bitcoin.

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