Skip to content
18

Base finite allocation

PortfolioOptimisers.FiniteAllocationOptimisationEstimator Type
julia
abstract type FiniteAllocationOptimisationEstimator <: OptimisationEstimator

Abstract 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

source
PortfolioOptimisers.FiniteAllocationOptimisationResult Type
julia
abstract type FiniteAllocationOptimisationResult <: OptimisationResult

Abstract supertype for finite allocation optimisation result types.

Related Types

source
PortfolioOptimisers.FiniteAllocationInput Type
julia
struct FiniteAllocationInput{__T_w, __T_prices, __T_cash, __T_horizon, __T_fees} <: AbstractEstimator

Problem 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 as w.

  • 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 when fees is provided.

  • fees: Optional fees to charge against the allocation over horizon.

Constructors

julia
FiniteAllocationInput(;
    w::VecNum,
    prices::VecNum,
    cash::Number = 1e6,
    horizon::Option{<:Number} = nothing,
    fees::Option{<:Fees} = nothing
) -> FiniteAllocationInput

Keywords correspond to the struct's fields.

Validation

  • !isempty(w), !isempty(prices).

  • length(w) == length(prices).

  • cash > 0.

  • horizon must not be nothing when fees is provided.

Related

source
PortfolioOptimisers.FOptE_FOpt Type
julia
const FOptE_FOpt = Union{<:FiniteAllocationOptimisationEstimator,
                         <:FiniteAllocationOptimisationResult}

Alias for a finite allocation optimisation estimator or result.

Matches either a FiniteAllocationOptimisationEstimator or a FiniteAllocationOptimisationResult.

Related

source
PortfolioOptimisers.setup_alloc_optim Function
julia
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

source
PortfolioOptimisers.adjust_long_cash Function
julia
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

source
PortfolioOptimisers.factory Method
julia
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