[R-SIG-Finance] Calculating trailing returns

Michael Weylandt michael.weylandt at gmail.com
Mon Oct 26 15:34:57 CET 2015


> On Oct 26, 2015, at 9:21, Am Gut <agquantr at gmail.com> wrote:
> 
> Dear R Users,
> 
> I am trying to calculate trailing month and annual returns with daily data.
> The data is already in returns, and not in price. I have been looking for a
> handy function to calculate trailing returns where I can specify the look
> back period (number of lags), but have been completely unsuccessful. Can
> anyone please suggest a way that I can calculate trailing returns from my
> dataset of many different return streams? Any help would be greatly
> appreciated.

Assuming you have geometric/log/continuously-compounded returns, aren't you just looking for a rolling sum? TTR and zoo both provide this. 

> 
> Kind Regards,
> 
> AG
> 
>    [[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



More information about the R-SIG-Finance mailing list