Base finite allocation
PortfolioOptimisers.FiniteAllocationOptimisationEstimator Type
abstract type FiniteAllocationOptimisationEstimator <: OptimisationEstimatorAbstract supertype for finite allocation portfolio optimisation estimators.
Finite allocation estimators convert continuous portfolio weights into discrete share quantities given an investment budget and asset prices.
Related Types
sourcePortfolioOptimisers.FiniteAllocationOptimisationResult Type
abstract type FiniteAllocationOptimisationResult <: OptimisationResultAbstract supertype for finite allocation optimisation result types.
Related Types
sourcePortfolioOptimisers.FiniteAllocationInput Type
struct FiniteAllocationInput{__T_w, __T_prices, __T_cash, __T_horizon, __T_fees} <: AbstractEstimatorProblem data fed to a finite allocation optimiser.
FiniteAllocationInput bundles the inputs shared by every finite allocation optimiser — the target continuous weights, current asset prices, cash budget, and optional time horizon and fees — into a single value passed as the second argument to optimise. It is consumed by both DiscreteAllocation and GreedyAllocation.
It subtypes AbstractEstimator rather than the FiniteAllocationOptimisationResult tree: it is the input to an allocation, not a computed output, and is deliberately kept clear of the OptimisationResult dispatch surface (plotting, result factory) that its fields cannot honour. See ADR 0017.
Fields
w: Target (continuous) portfolio weights to be discretised.prices: Current asset prices, in the same order asw.cash: Cash budget available for the allocation.horizon: Optional time horizon; used to adjust the cash budget for the fees charged over that horizon. Required whenfeesis provided.fees: Optional fees to charge against the allocation overhorizon.
Constructors
FiniteAllocationInput(;
w::VecNum,
prices::VecNum,
cash::Number = 1e6,
horizon::Option{<:Number} = nothing,
fees::Option{<:Fees} = nothing
) -> FiniteAllocationInputKeywords correspond to the struct's fields.
Validation
!isempty(w),!isempty(prices).length(w) == length(prices).cash > 0.horizonmust not benothingwhenfeesis provided.
Related
sourcePortfolioOptimisers.FOptE_FOpt Type
const FOptE_FOpt = Union{<:FiniteAllocationOptimisationEstimator,
<:FiniteAllocationOptimisationResult}Alias for a finite allocation optimisation estimator or result.
Matches either a FiniteAllocationOptimisationEstimator or a FiniteAllocationOptimisationResult.
Related
sourcePortfolioOptimisers.setup_alloc_optim Function
setup_alloc_optim(w, p, cash, ...)Set up the data structures needed for finite allocation optimisation.
Separates the portfolio into long and short positions, computes budgets and cash allocations for each side, and returns indices and cash values for downstream allocation routines.
Arguments
w: Portfolio weights vector.p: Asset price vector.cash: Total cash available.Additional parameters for budget configuration.
Returns
- Named tuple or multiple values with allocation setup data.
Related
sourcePortfolioOptimisers.adjust_long_cash Function
adjust_long_cash(bgt, lcash, scash)Adjust the long-side cash allocation based on budget and short-side cash.
Redistributes cash between long and short portfolio sides to satisfy the overall budget constraint.
Arguments
bgt: Portfolio budget (sum of weights target).lcash: Long-side cash allocation.scash: Short-side cash allocation.
Returns
- Adjusted long-side cash.
Related
sourcePortfolioOptimisers.factory Method
factory(res::FiniteAllocationOptimisationResult, fb::Option{<:FOptE_FOpt})Rebuild a finite allocation result with an updated fallback optimiser fb.
Like the continuous-result generic, every finite allocation result carries fb as its last field, so the rebuild copies all fields unchanged except the trailing fb. Concrete result types may override this method when rebuilding requires more than swapping fb.
Related
source