Expected Returns
Public
PortfolioOptimisers.ExpectedReturn Type
struct ExpectedReturn{__T_rt} <: NonOptimisationRiskMeasureReturn-based risk measure.
ExpectedReturn 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: Returns estimator.
Constructors
ExpectedReturn(;
rt::JuMPReturnsEstimator = ArithmeticReturn()
) -> ExpectedReturnKeywords correspond to the struct's fields.
Propagated parameters
When factory is called on this type, the following @fprop-tagged fields are automatically propagated:
rt: Recursively updated viafactory.
Examples
julia> ExpectedReturn()
ExpectedReturn
rt ┼ ArithmeticReturn
│ ucs ┼ nothing
│ lb ┼ nothing
│ mu ┴ nothingRelated
sourcePortfolioOptimisers.ExpectedReturnRiskRatio Type
struct ExpectedReturnRiskRatio{__T_rt, __T_rk, __T_rf} <: NonOptimisationRiskMeasureRatio-based risk measure.
ExpectedReturnRiskRatio 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: Returns estimator.rk: Risk measure for ratio computation.rf: Risk-free rate.
Constructors
ExpectedReturnRiskRatio(;
rt::JuMPReturnsEstimator = ArithmeticReturn(),
rk::AbstractBaseRiskMeasure = Variance(),
rf::Number = 0.0,
) -> ExpectedReturnRiskRatioKeywords correspond to the struct's fields.
Propagated parameters
When factory is called on this type, the following @fprop-tagged fields are automatically propagated:
Examples
julia> ExpectedReturnRiskRatio()
ExpectedReturnRiskRatio
rt ┼ ArithmeticReturn
│ ucs ┼ nothing
│ lb ┼ nothing
│ mu ┴ nothing
rk ┼ Variance
│ settings ┼ RiskMeasureSettings
│ │ scale ┼ Float64: 1.0
│ │ ub ┼ nothing
│ │ rke ┴ Bool: true
│ sigma ┼ nothing
│ chol ┼ nothing
│ rc ┼ nothing
│ alg ┴ SquaredSOCRiskExpr()
rf ┴ Float64: 0.0Related
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
sourcePortfolioOptimisers.expected_risk Function
expected_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
sourcePrivate
PortfolioOptimisers.PerfRM Type
const PerfRM = Union{...}Union of performance risk measures used to compute portfolio performance metrics (returns and return/risk ratios).
Related
sourcePortfolioOptimisers.PrRM Type
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.
Related
sourcePortfolioOptimisers.expected_return Function
expected_return(ret::ArithmeticReturn, w::VecNum, pr::AbstractPriorResult;
fees::Option{<:Fees} = nothing, kwargs...)
expected_return(ret::LogarithmicReturn, 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, logarithmic, and JuMP-based return estimators. For logarithmic 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(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...) -> aNo-op factory function for constructing objects with a uniform interface.
Defining methods which dispatch on the first argument allows for a consistent factory interface across different types.
Arguments
a: Indicates no object should be constructed.args...: Arbitrary positional arguments (ignored).kwargs...: Arbitrary keyword arguments (ignored).
Returns
a: The input unchanged.
Examples
julia> factory(nothing, 1, 2; x = 3)
julia> factory(MeanValue())
MeanValue
w ┴ nothingRelated
sourcefactory(
rs::AbstractBaseRiskMeasure,
args...;
kwargs...
) -> ConditionalValueatRiskRange{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, <:Number, <:Number} where {__T_scale, __T_ub, __T_rke}Return the risk measure rs unchanged.
Identity pass-through used when a risk measure is provided in a context that calls factory.
Related
sourcePortfolioOptimisers.factory Method
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...) -> aNo-op factory function for constructing objects with a uniform interface.
Defining methods which dispatch on the first argument allows for a consistent factory interface across different types.
Arguments
a: Indicates no object should be constructed.args...: Arbitrary positional arguments (ignored).kwargs...: Arbitrary keyword arguments (ignored).
Returns
a: The input unchanged.
Examples
julia> factory(nothing, 1, 2; x = 3)
julia> factory(MeanValue())
MeanValue
w ┴ nothingRelated
sourcefactory(
rs::AbstractBaseRiskMeasure,
args...;
kwargs...
) -> ConditionalValueatRiskRange{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, <:Number, <:Number} where {__T_scale, __T_ub, __T_rke}Return the risk measure rs unchanged.
Identity pass-through used when a risk measure is provided in a context that calls factory.
Related
sourcePortfolioOptimisers.needs_previous_weights Method
needs_previous_weights(r::AbstractBaseRiskMeasure) -> Bool
needs_previous_weights(r::VecBaseRM) -> BoolReturn whether risk measure r requires previous portfolio weights as input.
The default returns false. Override to true for risk measures such as turnover or tracking constraints that depend on prior weights. The VecBaseRM overload returns true if any element returns true.
Returns
Bool:trueif prior weights are required;falseotherwise.
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).