Closed ViktorMalesevic closed 6 years ago
resample('D') imputes na values for any day that didn't have a value(weekends, holidays). .dropna() removes the na values but it also implies that the original price series didn't have any days with na values. It seems reasonable to me. If months or years are missing then we will need dropna too.
Check my latest commit and see if it works for you. I would also appreciate it if you could write a test case with data below daily frequency.
I'll check your last commit and try to write a test case very soon! Thanks a lot!
Hi, and before anything thanks a lot for this great library!
As I have used the package a lot recently, I realized that the .stats object (as opposed to the .display()) gives weird results when given something else than daily data. I gave it monthly data, and then due to line 103 .dropduplicates in ffn/core.py, "best_month" would disappear, and the wished result would be in "best_day" (among other examples).
To overcome this type of issues I propose these changes in the ffn/core.py
Line 103: [x[0] for x in st if x[0] is not None]) Just deleting the .dropdupplicates()
Line 166: self.daily_prices = obj.resample('D').last() _Instead of self.dailyprices = obj
Line 173: p = self.daily_prices Instead of p = obj
With these changes it now gives NaN for all daily figures when given something else than daily data. And there is no risk of loosing a useful row in the .stats object anymore if two values happen to be identical.
Only drawback: .stats seem to have "yearly_sharpe" twice now, and due to the .resample('D').last() we might be slightly decreasing the execution speed.
Thanks again for this great package!