Skip to content
13

Naive optimisation

PortfolioOptimisers.NaiveOptimisationEstimator Type
julia
abstract type NaiveOptimisationEstimator <: NonFiniteAllocationOptimisationEstimator

Abstract supertype for naive (heuristic) portfolio optimisation estimators.

Naive optimisers compute portfolio weights directly from statistical properties of asset returns (e.g., volatility or equal weights) without solving an optimisation problem.

Related Types

source
PortfolioOptimisers.NaiveOptimisationResult Type
julia
struct NaiveOptimisationResult{__T_oe, __T_pr, __T_wb, __T_retcode, __T_w, __T_fb} <: NonFiniteAllocationOptimisationResult

Result type for naive portfolio optimisation estimators.

Fields

  • oe: Type of the optimisation estimator that produced this result.

  • pr: Prior result used in optimisation (or nothing).

  • wb: Weight bounds applied.

  • retcode: Optimisation return code (OptimisationSuccess or OptimisationFailure).

  • w: Optimal portfolio weights vector.

  • fb: Fallback result (if a fallback optimiser was used).

Related

source
PortfolioOptimisers.InverseVolatility Type
julia
struct InverseVolatility{__T_pe, __T_wb, __T_sets, __T_wf, __T_fb, __T_sq, __T_brt, __T_strict} <: NaiveOptimisationEstimator

Inverse Volatility portfolio optimiser.

InverseVolatility allocates portfolio weights inversely proportional to each asset's volatility (standard deviation). Optionally, sq = true uses variance instead.

Mathematical Definition

wi=1/σij=1N1/σj,

where σi is the standard deviation (or variance when sq = true) of asset i.

Fields

  • pe: Prior estimator or prior result for computing asset covariance.

  • wb: Weight bounds estimator or bounds.

  • sets: Asset sets (required when wb is a WeightBoundsEstimator).

  • wf: Weight finaliser for enforcing bounds.

  • fb: Fallback optimiser (used if this optimiser fails).

  • sq: If true, weights are inversely proportional to variance rather than volatility.

  • brt: If true, uses bootstrap returns instead of the original returns.

  • strict: If true, strictly enforces weight bounds.

Constructors

julia
InverseVolatility(;
    pe::PrE_Pr = EmpiricalPrior(),
    wb::Option{<:WbE_Wb} = WeightBounds(),
    sets::Option{<:AssetSets} = nothing,
    wf::WeightFinaliser = IterativeWeightFinaliser(),
    fb::Option{<:OptE_Opt} = nothing,
    sq::Bool = false,
    brt::Bool = false,
    strict::Bool = false
) -> InverseVolatility

Keywords correspond to the struct's fields.

Examples

julia
julia> InverseVolatility()
InverseVolatility
      pe ┼ EmpiricalPrior
         │        ce ┼ PortfolioOptimisersCovariance
         │           │   ce ┼ Covariance
         │           │      │    me ┼ SimpleExpectedReturns
         │           │      │       │   w ┴ nothing
         │           │      │    ce ┼ GeneralCovariance
         │           │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
         │           │      │       │    w ┴ nothing
         │           │      │   alg ┴ Full()
         │           │   mp ┼ DenoiseDetoneAlgMatrixProcessing
         │           │      │     pdm ┼ Posdef
         │           │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton
         │           │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()
         │           │      │      dn ┼ nothing
         │           │      │      dt ┼ nothing
         │           │      │     alg ┼ nothing
         │           │      │   order ┴ DenoiseDetoneAlg()
         │        me ┼ SimpleExpectedReturns
         │           │   w ┴ nothing
         │   horizon ┴ nothing
      wb ┼ WeightBounds
         │   lb ┼ Float64: 0.0
         │   ub ┴ Float64: 1.0
    sets ┼ nothing
      wf ┼ IterativeWeightFinaliser
         │   iter ┴ Int64: 100
      fb ┼ nothing
      sq ┼ Bool: false
     brt ┼ Bool: false
  strict ┴ Bool: false

Related

source
PortfolioOptimisers.EqualWeighted Type
julia
struct EqualWeighted{__T_wb, __T_sets, __T_wf, __T_fb, __T_strict} <: NaiveOptimisationEstimator

Equal-weighted portfolio optimiser.

EqualWeighted allocates equal weight to all N assets in the portfolio:

wi=1Ni.

Fields

  • wb: Weight bounds estimator or bounds.

  • sets: Asset sets (required when wb is a WeightBoundsEstimator).

  • wf: Weight finaliser for enforcing bounds.

  • fb: Fallback optimiser.

  • strict: If true, strictly enforces weight bounds.

Constructors

julia
EqualWeighted(;
    wb::Option{<:WbE_Wb} = WeightBounds(),
    sets::Option{<:AssetSets} = nothing,
    wf::WeightFinaliser = IterativeWeightFinaliser(),
    fb::Option{<:OptE_Opt} = nothing,
    strict::Bool = false
) -> EqualWeighted

Keywords correspond to the struct's fields.

Examples

julia
julia> EqualWeighted()
EqualWeighted
      wb ┼ WeightBounds
         │   lb ┼ Float64: 0.0
         │   ub ┴ Float64: 1.0
    sets ┼ nothing
      wf ┼ IterativeWeightFinaliser
         │   iter ┴ Int64: 100
      fb ┼ nothing
  strict ┴ Bool: false

Related

source
PortfolioOptimisers.RandomWeighted Type
julia
struct RandomWeighted{__T_alpha, __T_rng, __T_seed, __T_wb, __T_sets, __T_wf, __T_fb, __T_strict} <: NaiveOptimisationEstimator

Random-weighted portfolio optimiser.

RandomWeighted draws portfolio weights at random from a Dirichlet distribution with concentration parameter alpha. This can be used for simulation, benchmarking, or stress-testing.

Mathematical Definition

wDirichlet(α),

where α is a scalar or vector concentration parameter. Larger values of α concentrate the distribution near equal weights.

Fields

  • alpha: Dirichlet concentration parameter (scalar or vector, all positive).

  • rng: Random number generator.

  • seed: Optional seed for the RNG.

  • wb: Weight bounds estimator or bounds.

  • sets: Asset sets.

  • wf: Weight finaliser for enforcing bounds.

  • fb: Fallback optimiser.

  • strict: If true, strictly enforces weight bounds.

Constructors

julia
RandomWeighted(;
    alpha::Num_VecNum = 1,
    rng::Random.AbstractRNG = Random.default_rng(),
    seed::Option{<:Integer} = nothing,
    wb::Option{<:WbE_Wb} = nothing,
    sets::Option{<:AssetSets} = nothing,
    wf::WeightFinaliser = IterativeWeightFinaliser(),
    fb::Option{<:OptE_Opt} = nothing,
    strict::Bool = false
) -> RandomWeighted

Keywords correspond to the struct's fields.

Validation

  • If alpha is provided: all elements positive and finite.

Examples

julia
julia> RandomWeighted()
RandomWeighted
   alpha ┼ Int64: 1
     rng ┼ Random.TaskLocalRNG: Random.TaskLocalRNG()
    seed ┼ nothing
      wb ┼ nothing
    sets ┼ nothing
      wf ┼ IterativeWeightFinaliser
         │   iter ┴ Int64: 100
      fb ┼ nothing
  strict ┴ Bool: false

Related

source
PortfolioOptimisers.optimise Function
julia
optimise(iv::InverseVolatility{<:Any, <:Any, <:Any, <:Any, Nothing},
         rd::ReturnsResult = ReturnsResult(); dims::Int = 1, kwargs...) -> NaiveOptimisationResult

Arguments

  • iv: The inverse volatility optimiser to use.

  • rd: The returns result to use. If isa(iv.pe, AbstractPriorResult), rd is not necessary.

  • dims: The dimension along which observations advance in time.

  • kwargs: Additional keyword arguments passed to the optimisation function.

source
PortfolioOptimisers.optimise Method
julia
optimise(ew::EqualWeighted{<:Any, <:Any, <:Any, Nothing},
         rd::ReturnsResult; dims::Int = 1, kwargs...) -> NaiveOptimisationResult

Arguments

  • ew: The equal-weighted optimiser to use.

  • rd: The returns result to use. Used to know how many assets there are.

  • dims: The dimension along which observations advance in time.

  • kwargs: Additional keyword arguments passed to the optimisation function.

source
PortfolioOptimisers.optimise Method
julia
optimise(rw::RandomWeighted{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, Nothing},
         rd::ReturnsResult; dims::Int = 1, kwargs...) -> NaiveOptimisationResult

Arguments

  • rw: The random-weighted optimiser to use.

  • rd: The returns result to use. Used to know how many assets there are.

  • dims: The dimension along which observations advance in time.

  • kwargs: Additional keyword arguments passed to the optimisation function.

source