Expected Returns: private API

PortfolioOptimisers.PerfRMType
const PerfRM = Union{<:MeanReturn, <:MeanReturnRiskRatio, <:ExpectedReturn,
                     <:ExpectedReturnRiskRatio}

Union of performance risk measures used to compute portfolio performance metrics (returns and return/risk ratios).

The group exists because every one of its members reports a performance figure rather than a loss, so a larger value is a better one. bigger_is_better dispatches on this alias and answers true for all four in one method, which is the whole reason the four are grouped.

Related

source
PortfolioOptimisers.PrRMType
const PrRM = Union{<:ExpectedReturn, <:ExpectedReturnRiskRatio}

Union of prior-based return risk measures that are incompatible with PredictionResult inputs and require the use of MeanReturn or MeanReturnRiskRatio instead.

The group exists because both members read the prior result itself rather than a returns matrix, so neither declares a risk_input_kind. That one property drives every method that dispatches on the alias: the vector-of-weights route resolves the measure once and keeps the prior in hand, the prediction-result routes refuse the call, and supports_precomputed_returns answers false.

Related

source
PortfolioOptimisers.supports_precomputed_returnsMethod
supports_precomputed_returns(
    _::Union{ExpectedReturn, ExpectedReturnRiskRatio}
) -> Bool

Return false: a PrRM never supports precomputed returns.

Both members read the prior result and contract the expected returns it states with the portfolio weights. A bare net-return series carries neither the expected returns nor the weights, so r(x::VecNum) is undefined for the two types and neither defines one. The predicate answers here rather than reaching the erroring default of risk_input_kind, which reads to a caller as an internal fault rather than as a statement about the measure they chose.

To score a bare return series, name MeanReturn or MeanReturnRiskRatio instead, which is the substitution prrm_prediction_message names for the prediction-result routes.

Related

source
PortfolioOptimisers.term_feesFunction
term_fees(
    w::AbstractVector{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    _::Nothing,
    _::Number,
    _::Bool
) -> Any

Charge the fees to a return term only when that term's settings.fee says so.

The scalar twin follows the fee flag alone. Market impact is absent from expected_return on either side of the multiplicity, so this preserves a pre-existing divergence between the model expression and its scalar twin rather than widening one.

Arguments

  • w: Portfolio weights.
  • fees: Optional fees.
  • T: Observation count of the fit, over which the one-off terms are spread.
  • fee: The term's settings.fee flag.

Returns

Related

source
PortfolioOptimisers.sric_penaltyFunction
sric_penalty(sr::Number, pr::AbstractPriorResult) -> Any

Compute the estimation-error penalty that turns a ratio into a SRIC.

The penalty is applied once to the aggregate ratio, never per element. This is the only difference between expected_sric and expected_ratio, and between expected_risk_ret_sric and expected_risk_ret_ratio, so both SRIC functions delegate here rather than restate the ratio.

Mathematical definition

\[\begin{align} P(\mathrm{sr}) &= \dfrac{N}{T \, \mathrm{sr}}\,. \end{align}\]

Where:

  • $P(\mathrm{sr})$: Estimation-error penalty of the ratio $\mathrm{sr}$.
  • $\mathrm{sr}$: Aggregate risk-adjusted return ratio to penalise.
  • $T$: Number of observations.
  • $N$: Number of assets.

Arguments

  • sr: Aggregate risk-adjusted return ratio.
  • pr: Prior result. Its returns matrix supplies $T$ and $N$.

Returns

  • p::Number: The estimation-error penalty.

Related

source
PortfolioOptimisers.prrm_prediction_messageFunction
prrm_prediction_message(
    r::Union{ExpectedReturn, ExpectedReturnRiskRatio},
    pred
) -> String

Build the refusal a PrRM raises on a prediction result.

The refusal itself is about prior versus realised returns, and multiplicity does not touch it: a PrRM reads a prior result, and a prediction result carries a realised series instead.

The suggested replacement does depend on multiplicity. MeanReturn carries no return estimator, so it cannot hold the several terms a widened rt holds. When rt is a vector the message says so, rather than telling the caller that a lossy substitution is equivalent.

Algorithm

  1. Choose the replacement measure alt from the kind of r: MeanReturn for an ExpectedReturn, and MeanReturnRiskRatio for an ExpectedReturnRiskRatio.
  2. Write the first sentence of msg, naming r, the wrapper type of pred and alt.
  3. When the rt of r is a vector, append the second sentence, naming the number of terms it holds and the two routes that keep them.

Arguments

  • r: The measure that refuses the call.
  • pred: The prediction result the caller supplied.

Returns

  • msg::String: The message of the ArgumentError the refusing methods raise.

Related

source