# product of all elements in subsets of timeseries

apologies in advance if this is obvious, but I'm very new to mathematica and couldn't find the answer in the documentation nor in the forum here...

I've got a 2 year time series ts with daily percentage returns of a particular stock and want to create a table showing monthly total returns.

MonthlyAvReturns = Table[Mean[TimeSeriesWindow[ts, {{y, m, 1}, {y, m, 31}}]],{y,2015, 2016}, {m, 1, 12}]


The above gives me the average value of the data for each month. To get monthly returns, I'd need to multiply those values instead of adding them with Total[].

I'm sure there is a better way to do this than doing this manually via

JanReturns = TimeSeriesWindow[ts,{{2015, 1, 1}, {2015, 1, 31}}];
Times@@(JanReturns["Values"]+1)


Any pointers would be extremely welcome. Thanks in advance!

Also - this is a custom return series, so nothing that can be downloaded through FinancialData["ticker","CumulativeFractionalChange","dates"].

• What's wrong with replacing Mean with your Times@@(1+Values[...])? – swish Oct 13 '17 at 18:23
• If I do that, I get the error message: "Times@@" cannot be followed by "[TimeSeriesWindow[ts,{{y,m,1},{y,m,31}}]]". – flux Oct 16 '17 at 7:38