Score weight bounds

ScoreWeightBounds bounds the magnitude of each weight by a multiple of the score of its asset. The score comes from a risk measure or from an AbstractAssetScorer, such as a PanelFieldScorer of the median traded amount. Each fit scores the assets on its own returns, so a fold of a cross-validation reads only its training rows. The estimator goes in the wb field of an optimiser, and it tightens the static bounds that its own wb field holds.

PortfolioOptimisers.ScoreWeightBounds — Type
struct ScoreWeightBounds{__T_score, __T_val, __T_dval, __T_wb, __T_symmetric, __T_nonfinite} <: AbstractWeightBoundsEstimator

Bounds the magnitude of each weight by a multiple of the score of its asset, on the returns of each fit.

weight_bounds_constraints resolves the estimator in each fit. It scores the assets of the fit with asset_scores, multiplies each score by its entry of val, and joins the result with the static bounds of wb. The tighter bound wins at each asset. Each fit reads the scores of its own window, so a fold of a cross-validation reads the scores of its training rows, and the last fit reads the scores of the whole window.

Two common bounds are of this form.

  • A participation limit. The score is the median traded amount of the asset, PanelFieldScorer(; fields = ["adj_close", "adj_volume"]), and val = k / V, where V is the notional of the portfolio. A position then needs at most k days of trade to enter or to leave.
  • A bound relative to size. The score is the market capitalisation, and val is m divided by the capitalisation of the universe. No weight is then more than m times the capitalisation weight of its asset.

Mathematical definition

\[\begin{align} c_{i} &= v_{i} s_{i}\,,\\ \max(l_{i},\, -c_{i}) &\leq w_{i} \leq \min(u_{i},\, c_{i})\,. \end{align}\]

Where:

  • $s_{i}$: The score of asset $i$ on the returns of the fit.
  • $v_{i}$: The entry of val of asset $i$.
  • $c_{i}$: The score bound of asset $i$. An asset whose score is not finite takes nonfinite, or $+\infty$ when nonfinite is nothing. An infinite $v_{i}$ gives $c_{i} = +\infty$.
  • $l_{i}$, $u_{i}$: The static bounds of asset $i$ from wb.
  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.

With symmetric = false, the lower side is $l_{i}$ alone.

Fields

  • score: The risk measure or the Asset Scorer that gives the score of each asset on the returns of the fit, through asset_scores.
  • val: The multiple of the score that bounds the magnitude of each weight. A number is one multiple for every asset, and a vector holds one multiple per asset. A pair, a dictionary, a vector of pairs or an algorithmic rule names the multiples by asset or by group, and estimator_to_val resolves them against sets.
  • dval: Default value of each entry that val does not name.
  • wb: The static weight bounds that the score bound tightens. nothing states no static bound.
  • symmetric: If true, the score bounds both sides of the weight, -c <= w <= c. If false, it bounds the upper side alone, w <= c.
  • nonfinite: The bound c of an asset whose score is not finite. 0 admits no position in the asset. nothing states no bound from the score, so only wb bounds the asset.

Constructors

ScoreWeightBounds(;    score::BaseRM_AsSc,    val::VectorEstValType = 1,    dval::Option{<:Number} = nothing,    wb::Option{<:WbE_Wb} = WeightBounds(),    symmetric::Bool = true,    nonfinite::Option{<:Number} = 0) -> ScoreWeightBounds

Keywords correspond to the struct's fields. An asset that a pair, a dictionary or a vector of pairs in val does not name takes dval, or one(datatype) when dval is nothing.

Validation

  • score can score one asset, through assert_scoreable. An ArgumentError is thrown otherwise.
  • val is not empty, finite and non-negative, through assert_nonempty_nonneg_finite_val. An IsEmptyError or a DomainError is thrown otherwise. An algorithmic rule is not checked.
  • If dval is not nothing: dval >= 0, through assert_nonneg. This rule admits +Inf, which gives the assets that val does not name no bound from the score. A DomainError is thrown otherwise.
  • If nonfinite is not nothing: nonfinite >= 0, through assert_nonneg. A DomainError is thrown otherwise.

A score bound is a magnitude, so the resolution refuses a negative score. The static bounds of wb have no values until the fit, so the resolution also checks them against the score bound. weight_bounds_constraints states both checks.

View parameters

port_opt_view takes the view of these @vprop fields at the selected indices:

The view keeps score unchanged. The score reads the returns of the fit, and the fit views them by the same index.

Examples

julia> ScoreWeightBounds(; score = PanelFieldScorer(; fields = "volume"), val = 0.5)ScoreWeightBounds      score ┼ PanelFieldScorer            │    fields ┼ String: "volume"            │      stat ┼ MedianValue            │           │   w ┴ nothing            │       bib ┼ nothing            │   min_obs ┴ Int64: 1        val ┼ Float64: 0.5       dval ┼ nothing         wb ┼ WeightBounds            │   lb ┼ Float64: 0.0            │   ub ┴ Float64: 1.0  symmetric ┼ Bool: true  nonfinite ┴ Int64: 0

Related

source

weight_bounds_constraints documents the resolution of the estimator with its other methods.