Expected Risk
PortfolioOptimisers.MatNum_Pr Type
const MatNum_Pr = Union{<:MatNum, <:AbstractPriorResult, <:ReturnsResult}Union of matrix-like types accepted as the data argument in risk_contribution and related functions.
Related
sourcePortfolioOptimisers.ERkNetRet Type
const ERkNetRet = Union{...}Union of risk measures whose expected risk is computed on net returns (returns after fees).
These risk measures receive the net-returns vector calc_net_returns(w, X, fees) as their sole argument.
Related
sourcePortfolioOptimisers.ERkwXFees Type
const ERkwXFees = Union{...}Union of risk measures whose expected risk depends on both weights, returns matrix, and fees.
These risk measures are called as r(w, X, fees).
Related
sourcePortfolioOptimisers.ERkX Type
const ERkX = Union{<:ERkNetRet, <:ERkwXFees}Union of all risk measures that require the returns matrix X (and optionally fees) for expected risk computation.
Related
sourcePortfolioOptimisers.ERkw Type
const ERkw = Union{...}Union of risk measures whose expected risk depends only on portfolio weights.
These risk measures are called as r(w).
Related
sourcePortfolioOptimisers.TnTrRM Type
const TnTrRM = Union{<:TurnoverRiskMeasure, <:TrRM}Union of turnover and tracking risk measures used to update previous-weight dependent factories.
Related
sourcePortfolioOptimisers.SlvRM Type
const SlvRM = Union{...}Union of solver-based risk measures (entropic and relativistic families) that require an iterative solver for expected risk computation.
Related
sourcePortfolioOptimisers.RkRatioRM Type
const RkRatioRM = Union{<:RiskRatioRiskMeasure, <:NonOptimisationRiskRatioRiskMeasure}Union of all risk-ratio risk measures, where the expected risk is defined as the ratio of two component risk values.
Related
sourcePortfolioOptimisers.expected_risk Function
expected_risk(r::ExpectedReturn, w::VecNum, pr::AbstractPriorResult;
fees::Option{<:Fees} = nothing, kwargs...)Compute the expected risk for a portfolio using a return-based risk measure.
expected_risk returns the expected portfolio return as the risk metric, using the specified return estimator in the ExpectedReturn. This is useful for algorithms where risk is defined as expected return.
Arguments
r:ExpectedReturncontaining a return estimator.w: Portfolio weights.pr: Prior result.fees: Optional transaction fees.kwargs...: Additional keyword arguments.
Returns
risk::Number: Expected portfolio return (net of fees if provided).
Related
sourceexpected_risk(r::ExpectedReturnRiskRatio, w::VecNum, pr::AbstractPriorResult;
fees::Option{<:Fees} = nothing, kwargs...)Compute the expected risk for a portfolio using a ratio-based risk measure.
expected_risk returns the risk-adjusted return ratio (e.g., Sharpe ratio) for the portfolio, using the specified return estimator, risk measure, and risk-free rate in the ExpectedReturnRiskRatio.
Arguments
r:ExpectedReturnRiskRatiocontaining a return estimator, risk measure, and risk-free rate.w: Portfolio weights.pr: Prior result.fees: Optional transaction fees.kwargs...: Additional keyword arguments.
Returns
risk::Number: Risk-adjusted return ratio.
Related
sourcePortfolioOptimisers.number_effective_assets Function
number_effective_assets(w::VecNum)Compute the effective number of assets (Herfindahl-Hirschman inverse index):
Returns the number of equally-weighted assets that would produce the same level of concentration as the given weight vector w.
Arguments
w::VecNum: Portfolio weight vector.
Returns
Number: Effective number of assets.
Related
sourcePortfolioOptimisers.risk_contribution Function
risk_contribution(
r::AbstractBaseRiskMeasure,
w::VecNum,
X::MatNum_Pr,
fees::Option{<:Fees} = nothing;
delta::Number = 1e-6,
marginal::Bool = false,
kwargs...
) -> VectorCompute the risk contribution of each asset to the total portfolio risk using numerical differentiation.
The risk contribution of asset
where the partial derivative is approximated by a two-sided finite difference with step size delta. When marginal = true, the weighting by
Arguments
r::AbstractBaseRiskMeasure: Risk measure to differentiate.w::VecNum: Portfolio weights vector.X::MatNum_Pr: Asset returns matrix or prior result.fees::Option{<:Fees}: Optional fee structure.
Keyword Arguments
delta::Number = 1e-6: Finite difference step size.marginal::Bool = false: Iftrue, returns marginal risk contributions (withoutweighting).
Returns
Vector: Risk contributions (or marginal risks) for each asset.
Related
sourcePortfolioOptimisers.factor_risk_contribution Function
factor_risk_contribution(
r::AbstractBaseRiskMeasure,
w::VecNum,
X::MatNum_Pr,
fees::Option{<:Fees} = nothing;
re::RegE_Reg = StepwiseRegression(),
rd::ReturnsResult = ReturnsResult(),
delta::Number = 1e-6,
kwargs...
) -> VectorCompute the risk contribution of each factor (and the idiosyncratic component) to the total portfolio risk using a factor regression.
The factor risk contributions partition total portfolio risk into factor-specific components using the Brinson attribution framework:
where
Arguments
r::AbstractBaseRiskMeasure: Risk measure to decompose.w::VecNum: Portfolio weights vector.X::MatNum_Pr: Asset returns matrix or prior result.fees::Option{<:Fees}: Optional fee structure.
Keyword Arguments
re::RegE_Reg = StepwiseRegression(): Regression estimator for factor loadings.rd::ReturnsResult = ReturnsResult(): Returns result providing factor data.delta::Number = 1e-6: Finite difference step size.
Returns
Vector: Risk contributions for each factor, with the last element being the idiosyncratic (off-factor) contribution.
Related
source