Discrete allocation
PortfolioOptimisers.DiscreteAllocationResult Type
struct DiscreteAllocationResult{__T_oe, __T_retcode, __T_s_retcode, __T_l_retcode, __T_shares, __T_cost, __T_w, __T_cash, __T_s_model, __T_l_model, __T_fb} <: FiniteAllocationOptimisationResultResult type for Discrete Allocation portfolio optimisation.
Fields
oe: Type of the optimisation estimator that produced this result.retcode: Overall optimisation return code.s_retcode: Return code for the short allocation sub-problem.l_retcode: Return code for the long allocation sub-problem.shares: Vector of shares (integer quantities) for each asset.cost: Total cost of the allocated shares.w: Realised portfolio weights.cash: Remaining uninvested cash.s_model: JuMP model for the short allocation.l_model: JuMP model for the long allocation.fb: Fallback result.
Related
sourcePortfolioOptimisers.DiscreteAllocation Type
struct DiscreteAllocation{__T_slv, __T_sc, __T_so, __T_wf, __T_fb} <: FiniteAllocationOptimisationEstimatorDiscrete Allocation portfolio optimiser.
DiscreteAllocation allocates a portfolio by solving a Mixed-Integer Programming (MIP) problem to find the optimal number of shares for each asset, minimising the deviation between the target continuous weights and the realised discrete allocation.
Fields
slv: MIP solver or vector of solvers.sc: Constraint scale factor.so: Objective scale factor.wf: Weight error formulation (L1/L2 relative or absolute).fb: Fallback allocator (default:GreedyAllocation()).
Constructors
DiscreteAllocation(;
slv::Slv_VecSlv,
sc::Number = 1,
so::Number = 1,
wf::JuMPWeightFinaliserFormulation = AbsoluteErrorWeightFinaliser(),
fb::Option{<:FOptE_FOpt} = GreedyAllocation()
) -> DiscreteAllocationKeywords correspond to the struct's fields.
Validation
If
slvis a vector:!isempty(slv).sc > 0,so > 0.
Examples
julia> DiscreteAllocation(; slv = Solver())
DiscreteAllocation
slv ┼ Solver
│ name ┼ String: ""
│ solver ┼ nothing
│ settings ┼ nothing
│ check_sol ┼ @NamedTuple{}: NamedTuple()
│ add_bridges ┴ Bool: true
sc ┼ Int64: 1
so ┼ Int64: 1
wf ┼ AbsoluteErrorWeightFinaliser()
fb ┼ GreedyAllocation
│ unit ┼ Int64: 1
│ args ┼ Tuple{}: ()
│ kwargs ┼ @NamedTuple{}: NamedTuple()
│ fb ┴ nothingRelated
sourcePortfolioOptimisers.optimise Function
optimise(da::DiscreteAllocation{<:Any, <:Any, <:Any, Nothing}, w::VecNum,
p::VecNum, cash::Number = 1e6, T::Option{<:Number} = nothing,
fees::Option{<:Fees} = nothing; str_names::Bool = false,
save::Bool = true, kwargs...) -> DiscreteAllocationResultArguments
da: The discrete allocation optimiser to use.w: Portfolio weights vectorassets × 1.p: The prices of the assets in the same order asw.cash: The initial cash balance.T: The time horizon for the optimisation. Used to adjust the initial cash balance according to the fees charged on the portfolio for the time horizon.fees: The fees to apply to the portfolio.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.