pmorissette / ffn

ffn - a financial function library for Python
pmorissette.github.io/ffn
MIT License
1.9k stars 284 forks source link

divide by zero encountered in true_divide #188

Closed akitxu closed 1 year ago

akitxu commented 1 year ago

Dear all I apply FFN to a DataFrame with quotes downloaded from yfinance. It returns the following error:

/home/enri/anaconda3/envs/enri/lib/python3.9/site-packages/ffn/core.py:2299: RuntimeWarning:

divide by zero encountered in true_divide

/home/enri/anaconda3/envs/enri/lib/python3.9/site-packages/ffn/core.py:258: RuntimeWarning:

divide by zero encountered in true_divide

The error seems to originate from calculating the maximum drowdown.

  yearly_sharpe calmar max_drawdowns cagr
1.179086 inf 0.0 2.384173

What can be the cause?. How can I fix this error?. I will appreciate help