public class MarkowitzByQP extends Object
Constructor and Description |
---|
MarkowitzByQP(Vector mu,
Matrix sigma)
Constructs a Markowitz portfolio from expected future returns
and future covariance, assuming no short selling constraint and
zero benchmark rate.
|
MarkowitzByQP(Vector mu,
Matrix sigma,
QPConstraint constraints)
Constructs a Markowitz portfolio from expected future returns
and future covariance, assuming zero benchmark rate for Sharpe
ratio calculation.
|
MarkowitzByQP(Vector mu,
Matrix sigma,
QPConstraint constraints,
double benchmarkRate)
Constructs a Markowitz portfolio from expected future returns
and future covariance.
|
MarkowitzByQP(Vector mu,
Matrix sigma,
Vector lower,
Vector upper)
Constructs a Markowitz portfolio from expected future returns
and future covariance, with lower and upper limits on asset
weights, assuming zero benchmark rate.
|
MarkowitzByQP(Vector mu,
Matrix sigma,
Vector lower,
Vector upper,
double benchmarkRate)
Constructs a Markowitz portfolio from expected future returns
and future covariance for a given benchmark rate, with lower and
upper limits on asset weights.
|
Modifier and Type | Method and Description |
---|---|
double |
fw()
Evaluates \(E(w'r) - q * Var(w'r)\) at w_eff.
|
double |
getOptimalRiskAversionCoefficient()
Gets the optimal risk aversion coefficient w.r.t.
|
double |
getOptimalRiskAversionCoefficient(double lower,
double initial,
double upper)
Gets the optimal risk aversion coefficient w.r.t.
|
protected Vector |
getOptimalW(double q)
Solves w_eff = argmin {q * (w' Σ w) - w'r}.
|
Vector |
getOptimalWeights()
Gets the Markowitz optimal portfolio weights, for a given risk aversion
coefficient.
|
double |
getRiskAversionCoefficientForTargetReturn(double r,
double lower,
double upper,
int maxIterations) |
double |
getRiskAversionCoefficientForTargetVariance(double var,
double lower,
double upper,
int maxIterations) |
void |
setRiskAversionCoefficient(double q)
Sets the risk aversion coefficient, effectively moving along the
efficient frontier.
|
public MarkowitzByQP(Vector mu, Matrix sigma, QPConstraint constraints)
mu
- expected future returns of assetssigma
- future covariance of assetsconstraints
- the additional constraints on w_effpublic MarkowitzByQP(Vector mu, Matrix sigma, QPConstraint constraints, double benchmarkRate)
mu
- expected future returns of assetssigma
- future covariance of assetsconstraints
- the additional constraints on w_effbenchmarkRate
- the benchmark rate used to compute Sharpe ratiopublic MarkowitzByQP(Vector mu, Matrix sigma)
mu
- expected future returns of assetssigma
- future covariance of assetspublic MarkowitzByQP(Vector mu, Matrix sigma, Vector lower, Vector upper)
mu
- expected future returns of assetssigma
- future covariance of assetslower
- the lower limits of asset weightsupper
- the upper limits of asset weightspublic MarkowitzByQP(Vector mu, Matrix sigma, Vector lower, Vector upper, double benchmarkRate)
mu
- expected future returns of assetssigma
- future covariance of assetslower
- the lower limits of asset weightsupper
- the upper limits of asset weightsbenchmarkRate
- the benchmark rate used to compute Sharpe ratiopublic void setRiskAversionCoefficient(double q) throws QPInfeasible, Exception
q
- the risk aversion coefficientQPInfeasible
Exception
protected Vector getOptimalW(double q) throws Exception
q
- the risk-aversion coefficientQPInfeasible
- when the underlying quadratic programming problem is
infeasibleException
public Vector getOptimalWeights()
public double fw()
public double getOptimalRiskAversionCoefficient(double lower, double initial, double upper) throws Exception
lower
- lower bound for the search, e.g., 0initial
- an initial guess of where the optimal risk aversion
coefficient may beupper
- upper bound for the searchException
public double getOptimalRiskAversionCoefficient()
public double getRiskAversionCoefficientForTargetReturn(double r, double lower, double upper, int maxIterations) throws NoRootFoundException
NoRootFoundException
public double getRiskAversionCoefficientForTargetVariance(double var, double lower, double upper, int maxIterations) throws NoRootFoundException
NoRootFoundException
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.