diff --git a/quantstats/stats.py b/quantstats/stats.py index e544f373..28cb7760 100644 --- a/quantstats/stats.py +++ b/quantstats/stats.py @@ -93,7 +93,7 @@ def expected_return(returns, aggregate=None, compounded=True, prepare_returns=Tr if prepare_returns: returns = _utils._prepare_returns(returns) returns = _utils.aggregate_returns(returns, aggregate, compounded) - return _np.product(1 + returns) ** (1 / len(returns)) - 1 + return _np.prod(1 + returns) ** (1 / len(returns)) - 1 def geometric_mean(retruns, aggregate=None, compounded=True): @@ -512,7 +512,7 @@ def gain_to_pain_ratio(returns, rf=0, resolution="D"): return returns.sum() / downside -def cagr(returns, rf=0.0, compounded=True, periods=252): +def cagr(returns, rf=0.0, compounded=True): """ Calculates the communicative annualized growth return (CAGR%) of access returns @@ -526,7 +526,7 @@ def cagr(returns, rf=0.0, compounded=True, periods=252): else: total = _np.sum(total) - years = (returns.index[-1] - returns.index[0]).days / periods + years = (returns.index[-1] - returns.index[0]).days / 365 res = abs(total + 1.0) ** (1.0 / years) - 1