Greedy allocation
PortfolioOptimisers.GreedyAllocationResult Type
struct GreedyAllocationResult{__T_oe, __T_retcode, __T_shares, __T_cost, __T_w, __T_cash, __T_fb} <: FiniteAllocationOptimisationResultResult type for Greedy Allocation portfolio optimisation.
Fields
oe: Type of the optimisation estimator that produced this result.retcode: Optimisation return code.shares: Vector of shares allocated to each asset.cost: Total cost of the allocated shares.w: Realised portfolio weights.cash: Remaining uninvested cash.fb: Fallback result.
Related
sourcePortfolioOptimisers.GreedyAllocation Type
struct GreedyAllocation{__T_unit, __T_args, __T_kwargs, __T_fb} <: FiniteAllocationOptimisationEstimatorGreedy Allocation portfolio optimiser.
GreedyAllocation converts continuous portfolio weights to discrete share quantities using a greedy two-pass allocation: first round shares to the nearest unit multiple, then iteratively buy remaining shares with leftover cash in order of largest weight.
Fields
unit: Minimum share purchase unit (e.g., 1 for whole shares, 0.01 for fractional shares).args: Additional positional arguments forwarded toround.kwargs: Additional keyword arguments forwarded toround.fb: Fallback allocator.
Constructors
GreedyAllocation(;
unit::Number = 1,
args::Tuple = (),
kwargs::NamedTuple = (;),
fb::Option{<:FOptE_FOpt} = nothing
) -> GreedyAllocationKeywords correspond to the struct's fields.
Examples
julia> GreedyAllocation()
GreedyAllocation
unit ┼ Int64: 1
args ┼ Tuple{}: ()
kwargs ┼ @NamedTuple{}: NamedTuple()
fb ┴ nothingRelated
sourcePortfolioOptimisers.optimise Function
optimise(ga::GreedyAllocation{<:Any, <:Any, <:Any, Nothing}, w::VecNum, p::VecNum,
cash::Number = 1e6, T::Option{<:Number} = nothing,
fees::Option{<:Fees} = nothing; kwargs...) -> GreedyAllocationResultArguments
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.kwargs: Additional keyword arguments passed to the optimisation function.