def _get_gmv_monthly(self) -> Tuple[float, float]: """ Returns the risk and return (mean, monthly) of the Global Minimum Volatility portfolio """ return ( Rebalance.rebalanced_portfolio_return_ts( self.gmv_monthly_weights, self.ror, period=self.reb_period ).std(), Rebalance.rebalanced_portfolio_return_ts( self.gmv_monthly_weights, self.ror, period=self.reb_period ).mean(), )
def objective_function(w): # annual risk ts = Rebalance.rebalanced_portfolio_return_ts(w, self.ror, period=self.reb_period) risk_monthly = ts.std() mean_return = ts.mean() result = - Float.annualize_risk(risk_monthly, mean_return) return result
def gmv_annual_values(self) -> Tuple[float, float]: """ Returns the annual risk (std) and CAGR of the Global Minimum Volatility portfolio. """ returns = Rebalance.rebalanced_portfolio_return_ts(self.gmv_annual_weights, self.ror, period=self.reb_period) return ( Float.annualize_risk(returns.std(), returns.mean()), (returns + 1.0).prod() ** (_MONTHS_PER_YEAR / returns.shape[0]) - 1.0, )
def _get_cagr(self, weights): ts = Rebalance.rebalanced_portfolio_return_ts(weights, self.ror, period=self.reb_period) acc_return = (ts + 1.).prod() - 1. return (1. + acc_return) ** (_MONTHS_PER_YEAR / ts.shape[0]) - 1.
def objective_function(w): # Accumulated return for rebalanced portfolio time series objective_function.returns = Rebalance.rebalanced_portfolio_return_ts(w, ror, period=period) accumulated_return = (objective_function.returns + 1.).prod() - 1. return - accumulated_return
def objective_function(w): ts = Rebalance.rebalanced_portfolio_return_ts(w, ror, period=period) mean_return = ts.mean() risk = ts.std() return Float.annualize_risk(risk=risk, mean_return=mean_return)
def objective_function(w): risk = Rebalance.rebalanced_portfolio_return_ts(w, ror, period=period).std() return risk