Expected Returns
Public
PortfolioOptimisers.ReturnRiskMeasure Type
struct ReturnRiskMeasure{T1} <: NoOptimisationRiskMeasure
rt::T1
endReturn-based risk measure.
ReturnRiskMeasure is a risk measure that uses the expected portfolio return as its risk metric. This is useful for algorithms or analyses where the risk is defined as the expected return, used in portfolio performance analysis.
Fields
rt: Return estimator.
Constructor
ReturnRiskMeasure(; rt::JuMPReturnsEstimator = ArithmeticReturn())Examples
julia> ReturnRiskMeasure()
ReturnRiskMeasure
rt ┼ ArithmeticReturn
│ ucs ┼ nothing
│ lb ┼ nothing
│ mu ┴ nothingRelated
sourcePortfolioOptimisers.RatioRiskMeasure Type
struct RatioRiskMeasure{T1, T2, T3} <: NoOptimisationRiskMeasure
rt::T1
rk::T2
rf::T3
endRatio-based risk measure.
RatioRiskMeasure is a risk measure that computes the risk-adjusted return ratio, such as the Sharpe ratio, for a portfolio. It combines a return estimator, a risk measure, and a risk-free rate to produce a ratio metric, used in portfolio performance analysis.
Fields
rt: Return estimator.rk: Risk measure.rf: Risk-free rate.
Constructor
RatioRiskMeasure(; rt::JuMPReturnsEstimator = ArithmeticReturn(),
rk::AbstractBaseRiskMeasure = Variance(), rf::Number = 0.0)Examples
julia> RatioRiskMeasure()
RatioRiskMeasure
rt ┼ ArithmeticReturn
│ ucs ┼ nothing
│ lb ┼ nothing
│ mu ┴ nothing
rk ┼ Variance
│ settings ┼ RiskMeasureSettings
│ │ scale ┼ Float64: 1.0
│ │ ub ┼ nothing
│ │ rke ┴ Bool: true
│ sigma ┼ nothing
│ rc ┼ nothing
│ alg ┴ SquaredSOCRiskExpr()
rf ┴ Float64: 0.0Related
sourcePortfolioOptimisers.expected_risk Function
expected_risk(r::ReturnRiskMeasure, 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 ReturnRiskMeasure. This is useful for algorithms where risk is defined as expected return.
Arguments
r:ReturnRiskMeasurecontaining 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
sourcePortfolioOptimisers.expected_risk Function
expected_risk(r::RatioRiskMeasure, 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 RatioRiskMeasure.
Arguments
r:RatioRiskMeasurecontaining 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
sourcePrivate
PortfolioOptimisers.expected_return Function
expected_return(ret::ArithmeticReturn, w::VecNum, pr::AbstractPriorResult;
fees::Option{<:Fees} = nothing, kwargs...)
expected_return(ret::KellyReturn, w::VecNum, pr::AbstractPriorResult;
fees::Option{<:Fees} = nothing, kwargs...)
expected_return(ret::JuMPReturnsEstimator, w::VecVecNum, pr::AbstractPriorResult;
fees::Option{<:Fees} = nothing, kwargs...)Compute the expected portfolio return using the specified return estimator.
expected_return computes the expected return for a portfolio given its weights, a prior result, and optional transaction fees. Supports arithmetic, Kelly, and JuMP-based return estimators. For Kelly returns, computes the mean log-growth rate. For JuMP-based estimators, returns a vector of expected returns for each portfolio.
Arguments
ret: Return estimator.w: Portfolio weights.pr: Prior result.fees: Optional fees.kwargs...: Additional keyword arguments passed to underlying routines.
Returns
rt::Num_VecNum: Expected portfolio return(s), net of fees if provided.
Details
- For the third method,
expected_returnis broadcast over the vector of vectors of portfolio weights.
Related
PortfolioOptimisers.expected_ratio Function
expected_ratio(r::AbstractBaseRiskMeasure, ret::JuMPReturnsEstimator, w::VecNum,
pr::AbstractPriorResult; fees::Option{<:Fees} = nothing, rf::Number = 0,
kwargs...)Compute the expected risk-adjusted return ratio for a portfolio.
expected_ratio computes the ratio of expected portfolio return (net of fees and risk-free rate) to expected portfolio risk, using the specified risk measure and return estimator.
Arguments
r: Risk measure.ret: Return estimator.w: Portfolio weights.pr: Prior result.fees: Optional transaction fees.rf: Risk-free rate.kwargs...: Additional keyword arguments.
Returns
ratio::Number: Risk-adjusted return ratio.
Related
PortfolioOptimisers.expected_risk_ret_ratio Function
expected_risk_ret_ratio(r::AbstractBaseRiskMeasure, ret::JuMPReturnsEstimator, w::VecNum,
pr::AbstractPriorResult; fees::Option{<:Fees} = nothing,
rf::Number = 0, kwargs...)Compute expected risk, expected return, and risk-adjusted return ratio for a portfolio.
expected_risk_ret_ratio returns a tuple containing the expected portfolio risk, expected portfolio return, and the risk-adjusted return ratio, using the specified risk measure and return estimator.
Arguments
r: Risk measure.ret: Return estimator.w: Portfolio weights.pr: Prior result.fees: Optional transaction fees.rf: Risk-free rate.kwargs...: Additional keyword arguments.
Returns
risk::Number: Expected portfolio risk.return::Number: Expected portfolio return.ratio::Number: Risk-adjusted return ratio.
Related
PortfolioOptimisers.expected_sric Function
expected_sric(r::AbstractBaseRiskMeasure, ret::JuMPReturnsEstimator, w::VecNum,
pr::AbstractPriorResult; fees::Option{<:Fees} = nothing, rf::Number = 0,
kwargs...)Compute the risk-adjusted ratio information criterion (SRIC) for a portfolio.
expected_sric computes the SRIC, which adjusts the risk-adjusted return ratio for estimation error, penalizing overfitting in portfolio optimization. The SRIC is computed as the risk-adjusted return ratio minus a penalty term based on the number of assets and sample size.
Arguments
r: Risk measure.ret: Return estimator.w: Portfolio weights.pr: Prior result.fees: Optional transaction fees.rf: Risk-free rate.kwargs...: Additional keyword arguments.
Returns
sric::Number: Sharpe Ratio Information Criterion.
Related
PortfolioOptimisers.expected_risk_ret_sric Function
expected_risk_ret_sric(r::AbstractBaseRiskMeasure, ret::JuMPReturnsEstimator, w::VecNum,
pr::AbstractPriorResult; fees::Option{<:Fees} = nothing,
rf::Number = 0, kwargs...)Compute expected risk, expected return, and SRIC for a portfolio.
expected_risk_ret_sric returns a tuple containing the expected portfolio risk, expected portfolio return, and the Sharpe Ratio Information Criterion (SRIC), which adjusts the risk-adjusted return ratio for estimation error.
Arguments
r: Risk measure.ret: Return estimator.w: Portfolio weights.pr: Prior result (must contain asset return matrixX).fees: Optional transaction fees.rf: Risk-free rate (default: 0).kwargs...: Additional keyword arguments.
Returns
risk::Number: Expected portfolio risk.return::Number: Expected portfolio return.sric::Number: Sharpe Ratio Information Criterion.
Related
PortfolioOptimisers.factory Method
factory(r::ReturnRiskMeasure, pr::AbstractPriorResult, args...; kwargs...)Construct a new ReturnRiskMeasure object with an updated return estimator based on the provided prior result.
This function creates a new ReturnRiskMeasure instance by updating the internal return estimator using the prior result and any additional arguments or keyword arguments. This enables composable updates to risk measures that use expected return as their metric.
Arguments
r: AReturnRiskMeasureobject containing a return estimator.prior: Prior result used to update the return estimator.args...: Additional positional arguments for updating the return estimator.kwargs...: Additional keyword arguments for updating the return estimator.
Returns
r::ReturnRiskMeasure: New risk measure object with updated return estimator.
Details
Calls
factoryto update the return estimator using the prior result and arguments.Returns a new
ReturnRiskMeasureobject with the updated estimator.
Related
sourcePortfolioOptimisers.factory Method
factory(r::ReturnRiskMeasure, args...; kwargs...)Return the input ReturnRiskMeasure object unchanged.
This function provides a consistent interface for updating or copying return-based risk measures. It is used for composability in portfolio analytics workflows where the risk measure does not require modification.
Arguments
r: Return-based risk measure object.args...: Additional positional arguments (ignored).kwargs...: Additional keyword arguments (ignored).
Returns
r::ReturnRiskMeasure: The input risk measure object.
Details
Returns the input object unchanged.
Ensures interface consistency for factory operations.
Related
sourcePortfolioOptimisers.factory Method
factory(r::RatioRiskMeasure, pr::AbstractPriorResult, args...; kwargs...)Construct a new RatioRiskMeasure object with updated return and risk estimators based on the provided prior result.
This function creates a new RatioRiskMeasure instance by updating the internal return estimator and risk measure using the prior result and any additional arguments or keyword arguments. This enables composable updates to ratio-based risk measures in portfolio analytics workflows.
Arguments
r: Ratio-based risk measure object.prior: Prior result used to update the return estimator and risk measure.args...: Additional positional arguments for updating the estimators.kwargs...: Additional keyword arguments for updating the estimators.
Returns
r::RatioRiskMeasure: New risk measure object with updated return estimator and risk measure.
Details
Calls
factory(r.rt, pr, args...; kwargs...)to update the return estimator using the prior result and arguments.Calls
factory(r.rk, pr, args...; kwargs...)to update the risk measure using the prior result and arguments.Returns a new
RatioRiskMeasureobject with the updated fields and original risk-free rate.
Related
sourcePortfolioOptimisers.factory Method
factory(r::RatioRiskMeasure{<:Any, <:UncertaintySetVariance}, ucs::UcSE_UcS; kwargs...)Construct a new RatioRiskMeasure object with an updated uncertainty set risk measure.
This function creates a new RatioRiskMeasure instance by updating the internal risk measure using the provided uncertainty set and any additional keyword arguments. The return estimator and risk-free rate are preserved. This enables composable updates to ratio-based risk measures in portfolio analytics workflows.
Arguments
r: Ratio-based risk measure object.ucs: Uncertainty set for updating the internal risk measure.kwargs...: Additional keyword arguments for updating the risk measure.
Returns
r::RatioRiskMeasure: New risk measure object with updated uncertainty set risk measure.
Details
Calls
factory(r.rk, ucs; kwargs...)to update the risk measure.Preserves the return estimator and risk-free rate.
Returns a new
RatioRiskMeasureobject with the updated risk measure.
Related
sourcePortfolioOptimisers.factory Method
factory(r::RatioRiskMeasure{<:Any, <:SlvRM}, slv::Slv_VecSlv; kwargs...)Construct a new RatioRiskMeasure object with an updated solver-based risk measure.
Creates a new RatioRiskMeasure instance by updating the internal risk measure using the provided solver and any additional keyword arguments. The return estimator and risk-free rate are preserved. Enables composable updates to ratio-based risk measures in portfolio analytics workflows.
Arguments
r: Ratio-based risk measure object.slv: Solver or vector of solvers for updating the internal risk measure.kwargs...: Additional keyword arguments for updating the risk measure.
Returns
r::RatioRiskMeasure: New risk measure object with updated solver-based risk measure.
Details
Calls
factory(r.rk, slv; kwargs...)to update the risk measure.Preserves the return estimator and risk-free rate.
Returns a new
RatioRiskMeasureobject with the updated risk measure.
Related
sourcePortfolioOptimisers.factory Method
factory(r::RatioRiskMeasure{<:Any, <:TnTrRM}, w::VecNum)Construct a new RatioRiskMeasure object with updated risk measure weights.
This function creates a new RatioRiskMeasure instance by updating the internal risk measure using the provided portfolio weights w. The return estimator and risk-free rate are preserved. This enables composable updates to ratio-based risk measures in portfolio analytics workflows.
Arguments
r: Ratio-based risk measure object.w: Portfolio weights to update the internal risk measure.
Returns
r::RatioRiskMeasure: New risk measure object with updated risk measure.
Details
Calls
factory(r.rk, w)to update the risk measure.Preserves the return estimator and risk-free rate.
Returns a new
RatioRiskMeasureobject with the updated risk measure.
Related
sourcePortfolioOptimisers.brinson_attribution Function
brinson_attribution(X::TimeArray, w::VecNum, wb::VecNum,
asset_classes::DataFrame, col; date0 = nothing, date1 = nothing)Compute Brinson performance attribution aggregated per asset class [3].
brinson_attribution generates a DataFrame summarizing the Brinson performance attribution, decomposing total excess return into asset allocation, security selection, interaction, and total effect for each asset class. The calculation is performed over the specified date range, using the provided asset weights, benchmark weights, and asset class assignments.
Arguments
X: TimeArray of asset prices or returns.w: Vector of portfolio weights.wb: Vector of benchmark weights.asset_classes: DataFrame containing asset class assignments for each asset.col: Column inasset_classesspecifying the class for each asset.date0: (Optional) Start date for the attribution period.date1: (Optional) End date for the attribution period.
Returns
df::DataFrame: DataFrame with rows for asset allocation, security selection, interaction, and total effect, and columns for each asset class and the total.
Details
Computes returns for the specified period.
Aggregates attribution effects by asset class.
Supports custom date ranges via
date0anddate1.Returns a DataFrame with attribution breakdown for each class and the total.
Related
References
- [3] G. P. Brinson and N. Fachler. Measuring non-US. equity portfolio performance. The Journal of Portfolio Management 11, 73–76 (1985).