amirsani/pySharpeRratio

Compatibility with Pandas 0.23.x

Closed this issue · 3 comments

There is no longer a pd.expanding_max or pd.expanding_min function, there's a few ways to get around this or support both.

One way using pandas 0.23.x

    expanding_window = pd.core.window.expanding(pd.Series(np.cumsum(x)), min_periods=1)
    rolling_max = expanding_window.max().values
    rolling_min = expanding_window.min().values

Another numpy only solution:

https://stackoverflow.com/questions/6811183/rolling-window-for-1d-arrays-in-numpy

Hi Nicholas,

Thanks for providing a solution. Send me a pull request and I'll merge it. Otherwise just let me know and I'll make the changes later today.

Best,

Amir

Just made the change. I'll test it later today, but it looks good.

Thanks again,

Amir

Thanks I updated the requirements.txt file as well now