quantopy.ReturnDataFrame.gmean

ReturnDataFrame.gmean()[source]

Compute the geometric mean of series of simple returns. Commonly used to determine the performance results of an investment or portfolio.

Return the geometric average of the simple returns. That is: n-th root of (1+R1) * (1+R2) * … * (1+Rn)

Returns
ReturnSeries

The geometric mean of past simple returns

References

1

“Weighted Geometric Mean”, Wikipedia, https://en.wikipedia.org/wiki/Weighted_geometric_mean.

Examples

>>> rdf = qp.ReturnDataFrame(
            {
                "stock_1": [0.5, 0.333333],
                "stock_2": [-0.333333, 0.75]
            }
    )
>>> rdf.gmean()
stock_1    0.414213
stock_2    0.080124
dtype: float64