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

Avg Up Month/Down Month may not be aggregating correctly #386

Open
memura opened this issue Nov 28, 2024 · 0 comments
Open

Avg Up Month/Down Month may not be aggregating correctly #386

memura opened this issue Nov 28, 2024 · 0 comments

Comments

@memura
Copy link

memura commented Nov 28, 2024

I find that if I pass in both a strategy and benchmark to calculate metrics, where the benchmark returns are all positive (like a cash index) the avg_loss function (quantstats.reports.metrics l.1139) ends up removing all rows as NaNs are present in every row for the benchmark, arising from the line
quantstats.stats.avg_loss l.223: returns[returns < 0].dropna().mean()

The strategy and benchmark need to be treated separately in the _stats.avg_loss function when calling dropna() ... may also be happening for _stats.avg_win function and anything else with dropna() in it.

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

1 participant