Skip to content
13

Mean Risk

PortfolioOptimisers.MeanRiskResult Type
julia
struct MeanRiskResult{__T_oe, __T_pa, __T_retcode, __T_sol, __T_model, __T_fb} <: NonFiniteAllocationOptimisationResult

Result type for Mean-Risk portfolio optimisation.

Fields

  • oe: Type of the optimisation estimator that produced this result.

  • pa: Processed optimisation attributes.

  • retcode: Optimisation return code.

  • sol: Optimisation solution (or vector of solutions for the efficient frontier).

  • model: The JuMP model used for optimisation.

  • fb: Fallback result (if a fallback optimiser was used).

The w property is forwarded from sol.w.

Related

source
PortfolioOptimisers.MeanRisk Type
julia
struct MeanRisk{__T_opt, __T_r, __T_obj, __T_wi, __T_fb} <: RiskJuMPOptimisationEstimator

Mean-Risk portfolio optimiser.

MeanRisk formulates and solves a mean-risk portfolio optimisation problem using JuMP. It can optimise a wide variety of objective functions (minimum risk, maximum return, maximum Sharpe ratio, maximum utility) subject to risk, weight, cardinality, and custom constraints.

Fields

  • opt: JuMP optimiser configuration (prior, solver, constraints, bounds, fees, etc.).

  • r: Risk measure or vector of risk measures.

  • obj: Portfolio objective function.

  • wi: Initial portfolio weights for warm-starting the solver (or nothing).

  • fb: Fallback optimiser.

Constructors

julia
MeanRisk(;
    opt::JuMPOptimiser = JuMPOptimiser(),
    r::RM_VecRM = Variance(),
    obj::ObjectiveFunction = MinimumRisk(),
    wi::Option{<:VecNum} = nothing,
    fb::Option{<:OptE_Opt} = nothing
) -> MeanRisk

Keywords correspond to the struct's fields.

Validation

  • If r is a vector: !isempty(r).

  • If wi is provided: !isempty(wi).

Examples

julia
julia> MeanRisk(; opt = JuMPOptimiser(; slv = Solver()))
MeanRisk
  opt ┼ JuMPOptimiser
      │        pe ┼ EmpiricalPrior
      │           │        ce ┼ PortfolioOptimisersCovariance
      │           │           │   ce ┼ Covariance
      │           │           │      │    me ┼ SimpleExpectedReturns
      │           │           │      │       │   w ┴ nothing
      │           │           │      │    ce ┼ GeneralCovariance
      │           │           │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
      │           │           │      │       │    w ┴ nothing
      │           │           │      │   alg ┴ Full()
      │           │           │   mp ┼ DenoiseDetoneAlgMatrixProcessing
      │           │           │      │     pdm ┼ Posdef
      │           │           │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton
      │           │           │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()
      │           │           │      │      dn ┼ nothing
      │           │           │      │      dt ┼ nothing
      │           │           │      │     alg ┼ nothing
      │           │           │      │   order ┴ DenoiseDetoneAlg()
      │           │        me ┼ SimpleExpectedReturns
      │           │           │   w ┴ nothing
      │           │   horizon ┴ nothing
      │       slv ┼ Solver
      │           │          name ┼ String: ""
      │           │        solver ┼ nothing
      │           │      settings ┼ nothing
      │           │     check_sol ┼ @NamedTuple{}: NamedTuple()
      │           │   add_bridges ┴ Bool: true
      │        wb ┼ WeightBounds
      │           │   lb ┼ Float64: 0.0
      │           │   ub ┴ Float64: 1.0
      │       bgt ┼ Float64: 1.0
      │      sbgt ┼ nothing
      │        lt ┼ nothing
      │        st ┼ nothing
      │      lcse ┼ nothing
      │       cte ┼ nothing
      │    gcarde ┼ nothing
      │   sgcarde ┼ nothing
      │      smtx ┼ nothing
      │     sgmtx ┼ nothing
      │       slt ┼ nothing
      │       sst ┼ nothing
      │      sglt ┼ nothing
      │      sgst ┼ nothing
      │        tn ┼ nothing
      │      fees ┼ nothing
      │      sets ┼ nothing
      │        tr ┼ nothing
      │       ple ┼ nothing
      │       ret ┼ ArithmeticReturn
      │           │   ucs ┼ nothing
      │           │    lb ┼ nothing
      │           │    mu ┴ nothing
      │       sca ┼ SumScalariser()
      │      ccnt ┼ nothing
      │      cobj ┼ nothing
      │        sc ┼ Int64: 1
      │        so ┼ Int64: 1
      │        ss ┼ nothing
      │      card ┼ nothing
      │     scard ┼ nothing
      │       nea ┼ nothing
      │        l1 ┼ nothing
      │        l2 ┼ nothing
      │      linf ┼ nothing
      │        lp ┼ nothing
      │       brt ┼ Bool: false
      │    cle_pr ┼ Bool: true
      │    strict ┴ Bool: false
    r ┼ Variance
      │   settings ┼ RiskMeasureSettings
      │            │   scale ┼ Float64: 1.0
      │            │      ub ┼ nothing
      │            │     rke ┴ Bool: true
      │      sigma ┼ nothing
      │       chol ┼ nothing
      │         rc ┼ nothing
      │        alg ┴ SquaredSOCRiskExpr()
  obj ┼ MinimumRisk()
   wi ┼ nothing
   fb ┴ nothing

Related

source
PortfolioOptimisers.solve_mean_risk! Function
julia
solve_mean_risk!(model, mr, ret, pr, ::Val{false}, ::Val{false}, args...)
solve_mean_risk!(model, mr, ret, pr, ::Val{true}, ::Val{false}, fees)
solve_mean_risk!(model, mr, ret, pr, ::Val{false}, ::Val{true}, fees)
solve_mean_risk!(model, mr, ret, pr, ::Val{true}, ::Val{true}, fees)

Solve the Mean-Risk optimisation problem.

Dispatches based on whether a return frontier and/or risk frontier sweep is requested (controlled by Val arguments). Single-point, return-frontier, risk-frontier, and combined sweeps are all handled.

Arguments

  • model::JuMP.Model: JuMP optimisation model.

  • mr::MeanRisk: MeanRisk estimator configuration.

  • ret::JuMPReturnsEstimator: Returns estimator.

  • pr::AbstractPriorResult: Prior result with asset moments.

  • ::Val{bool}: Whether to do a return frontier sweep.

  • ::Val{bool}: Whether to do a risk frontier sweep.

  • fees: Optional fees configuration.

Returns

  • (retcode, sol) or (retcodes, sols) depending on the sweep mode.

Related

source
PortfolioOptimisers.optimise Function
julia
optimise(mr::MeanRisk{<:Any, <:Any, <:Any, <:Any, Nothing},
         rd::ReturnsResult = ReturnsResult(); dims::Int = 1,
         str_names::Bool = false, save::Bool = true, kwargs...) -> MeanRiskResult

Arguments

  • mr: The mean risk optimiser to use.

  • rd: The returns result to use. If isa(hec.opt.pe, AbstractPriorResult), rd is not necessary if doing a standalone optimisation, but may be required/desired by fallbacks and/or clusterisation.

  • dims: The dimension along which observations advance in time.

  • str_names: Whether to use string names for the assets in the optimisation.

  • save: Whether to save the JuMP model in the optimisation result.

  • kwargs: Additional keyword arguments passed to the optimisation function.

source