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

Bug: Yearly Kurtosis #81

Open
AnthonyFJGarner opened this issue Sep 8, 2019 · 2 comments
Open

Bug: Yearly Kurtosis #81

AnthonyFJGarner opened this issue Sep 8, 2019 · 2 comments
Labels

Comments

@AnthonyFJGarner
Copy link

AnthonyFJGarner commented Sep 8, 2019

Using 849 data points and 1188 calendar days between start and end, an error is thrown in the calculation of yearly kurtosis. A runtime warning is given as shown below. Adding a day of data solves that problem. For some reason a divide by zero error is caused. No doubt I will find the source of the error but I thought I would report it nonetheless.

start: datetime.date = '2001-10-02'
end: datetime.date = '2005-01-02'
1188 days 849 data points
\lib\site-packages\ffn\core.py:2056: RuntimeWarning: divide by zero encountered in true_divide
res = np.divide(er.mean(), std)

start: datetime.date = '2001-10-02'
end: datetime.date = '2005-01-03'
1189 days 850 data points
No error occurs

@yitelee
Copy link

yitelee commented Dec 8, 2020

function calc_sortino_ratio may encounter situations that all given returns are positive, makes the std = 0 and thus the divide by zero error.

    negative_returns = np.minimum(returns[1:], 0.)
    std = np.std(negative_returns, ddof=1)
    res = np.divide(er.mean(), std)

@keepcosmos
Copy link

Any update?

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

No branches or pull requests

4 participants