Stacking
PortfolioOptimisers.BaseStackingOptimisationEstimator Type
abstract type BaseStackingOptimisationEstimator <: NonFiniteAllocationOptimisationEstimatorAbstract supertype for stacking-based portfolio optimisation estimators.
Related Types
sourcePortfolioOptimisers.StackingResult Type
struct StackingResult{__T_oe, __T_pr, __T_wb, __T_fees, __T_resi, __T_reso, __T_cv, __T_retcode, __T_w, __T_fb} <: NonFiniteAllocationOptimisationResultResult type for Stacking portfolio optimisation.
Fields
oe: Type of the optimisation estimator that produced this result.pr: Prior result used in optimisation.wb: Weight bounds applied.fees: Fee structure applied (ornothing).resi: Inner optimisation results.reso: Outer optimisation result.cv: Cross-validation result (ornothing).retcode: Overall return code.w: Final aggregated portfolio weights.fb: Fallback result.
Related
sourcePortfolioOptimisers.Stacking Type
struct Stacking{__T_pe, __T_wb, __T_fees, __T_sets, __T_scale, __T_opti, __T_opto, __T_cv, __T_wf, __T_ex, __T_fb, __T_brt, __T_strict} <: BaseStackingOptimisationEstimatorStacking portfolio optimiser.
Stacking implements a stacking (model combination) approach to portfolio optimisation. It applies multiple inner optimisers (opti) to the data, then combines their outputs with a single outer optimiser (opto) to produce a final portfolio. Optionally, cross-validation can be used to weight the inner optimisers' contributions.
Fields
pe: Prior estimator or prior result.wb: Weight bounds estimator or bounds.fees: Fee estimator or fee structure.sets: Asset sets.scale: Optional scaling vector for inner optimiser weights (length must matchopti).opti: Vector of inner portfolio optimisers.opto: Outer portfolio optimiser combining inner results.cv: Cross-validation configuration for weighting inner optimisers.wf: Weight finaliser for enforcing bounds.ex: FLoops executor for parallelism.fb: Fallback optimiser.brt: Iftrue, uses bootstrap returns.strict: Iftrue, strictly enforces weight bounds.
Constructors
Stacking(;
pe::PrE_Pr = EmpiricalPrior(),
wb::Option{<:WbE_Wb} = nothing,
fees::Option{<:FeesE_Fees} = nothing,
sets::Option{<:AssetSets} = nothing,
scale::Option{<:VecNum} = nothing,
opti::VecOptE_Opt,
opto::NonFiniteAllocationOptimisationEstimator,
cv::Option{<:OptimisationCrossValidation} = nothing,
wf::WeightFinaliser = IterativeWeightFinaliser(),
ex::FLoops.Transducers.Executor = FLoops.ThreadedEx(),
fb::Option{<:OptE_Opt} = nothing,
brt::Bool = false,
strict::Bool = false
) -> StackingKeywords correspond to the struct's fields.
Validation
!isempty(opti).If
scaleis provided:length(scale) == length(opti)and all elements are finite.
Related
sourcePortfolioOptimisers.predict_outer_st_estimator_returns Function
Overload this using st.cv for custom cross-validation prediction
sourcePortfolioOptimisers.assert_special_nco_requirements Method
assert_special_nco_requirements(opt)Assert that the optimiser meets special requirements for Nested Clustered Optimisation (NCO).
The default implementation does nothing. Overridden for estimators (e.g. Stacking) that have requirements which must be validated before NCO can proceed.
Arguments
opt: Optimisation estimator, result, or vector thereof.
Returns
nothing.
Related
sourcePortfolioOptimisers.optimise Method
optimise(st::Stacking{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:Any, <:Any, Nothing
}, rd::ReturnsResult;
dims::Int = 1, branchorder::Symbol = :optimal, str_names::Bool = false,
save::Bool = true, kwargs...) -> StackingResultArguments
nco: The nested clustered optimiser to use.rd: The returns result to use.dims: The dimension along which observations advance in time.branchorder: Passed to the inner and outer optimisers. The branch order to use for the clusterisation.str_names: Passed to the inner and outer optimisers. Whether to use string names for the assets in the optimisation.save: Passed to the inner and outer optimisers. Whether to save the JuMP model in the optimisation result.kwargs: Additional keyword arguments passed to the optimisation function.