Class PortfolioUtils


  • public class PortfolioUtils
    extends Object
    • Method Detail

      • getPortfolioReturns

        public static double getPortfolioReturns​(Vector weights,
                                                 Vector mu)
        Computes the expected portfolio return.
        Parameters:
        weights - the weights of assets
        mu - the expected returns of assets
        Returns:
        the expected portfolio return
      • getPortfolioVariance

        public static double getPortfolioVariance​(Vector weights,
                                                  Matrix sigma)
        Computes the portfolio variance.
        Parameters:
        weights - the weights of assets
        sigma - the covariances of assets
        Returns:
        the portfolio variance
      • getSharpeRatio

        public static double getSharpeRatio​(Vector weights,
                                            Vector mu,
                                            Matrix sigma,
                                            double benchmarkRate)
        Computes the portfolio Sharpe ratio.
        Parameters:
        weights - the weights of assets
        mu - the expected returns of assets
        sigma - the covariances of assets
        benchmarkRate - the risk free/benchmark rate
        Returns:
        the portfolio Sharpe ratio