Package tech.nmfin.portfoliooptimization
Class PortfolioUtils
- java.lang.Object
-
- tech.nmfin.portfoliooptimization.PortfolioUtils
-
public class PortfolioUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
getPortfolioReturns(Vector weights, Vector mu)
Computes the expected portfolio return.static double
getPortfolioVariance(Vector weights, Matrix sigma)
Computes the portfolio variance.static double
getSharpeRatio(Vector weights, Vector mu, Matrix sigma, double benchmarkRate)
Computes the portfolio Sharpe ratio.
-
-
-
Method Detail
-
getPortfolioReturns
public static double getPortfolioReturns(Vector weights, Vector mu)
Computes the expected portfolio return.- Parameters:
weights
- the weights of assetsmu
- 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 assetssigma
- 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 assetsmu
- the expected returns of assetssigma
- the covariances of assetsbenchmarkRate
- the risk free/benchmark rate- Returns:
- the portfolio Sharpe ratio
-
-