santoshlite / Empyrial

An Open Source Portfolio Backtesting Engine for Everyone | 面向所有人的开源投资组合回测引擎
https://empyrial.gitbook.io/empyrial/
MIT License
914 stars 124 forks source link

empyrial bugs with start_date and bug with strategy vs benchmark for … #72

Closed rgleavenworth closed 2 years ago

rgleavenworth commented 2 years ago

…returns

rgleavenworth commented 2 years ago

I've fixed the bugs with strategy vs benchmark returns. The bug in the monthly and annual returns was due to the benchmark having a NaN value in the first value in the series which was treated as a 1 by quantstats. You have to dropna() to get the values to match betwen strategy and benchmark

Besides this, you were using the wrong datetime strptime for converting start date to datetime. I've fixe this too.

santoshlite commented 2 years ago

Thanks, @rgleavenworth for your contribution! Install Empyrial 2.0.1 and it should work now!

rgleavenworth commented 2 years ago

Outstanding! Thanks

atobiese commented 2 years ago

Hi, I looked quickly at the #72, but this does not solve the underlying problem in the calculations with rebalancing. A simple check is to run the same test as in #65, over a larger time interval, and specifying an end date. Run one with balancing and one w/o. Then compare cagr and cumulative returns for the two cases. The values should be identical within the num precision (there are huge differences). I will look at this when time.