def get_compounded_indicator_cumulative(self):
    indicator_dm = self.get_indicator_returns()
dates = indicator_dm.index
indicator_returns = indicator_dm['indicator_returns']
compounded = array(zeros(size(indicator_returns)))
compounded[1] = indicator_returns[1]
for i in range(2, len(indicator_returns)):
    compounded[i] = (1 + compounded[i - 1]) * (1 + indicator_returns[i]) - 1
data = {'compounded_returns': compounded}
return DataMatrix(data, index=dates)
Compute a compounded return series in Python