Expected Returns
Public
PortfolioOptimisers.ExpectedReturn Type
struct ExpectedReturn{T1} <: NonOptimisationRiskMeasure
rt::T1
endReturn-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: Return estimator.
Constructor
ExpectedReturn(; rt::JuMPReturnsEstimator = ArithmeticReturn())Examples
julia> ExpectedReturn()
ExpectedReturn
rt ┼ ArithmeticReturn
│ ucs ┼ nothing
│ lb ┼ nothing
│ mu ┴ nothingRelated
[
JuMPReturnsEstimator]-(@ref)
PortfolioOptimisers.ExpectedReturnRiskRatio Type
struct ExpectedReturnRiskRatio{T1, T2, T3} <: NonOptimisationRiskMeasure
rt::T1
rk::T2
rf::T3
endRatio-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: Return estimator.rk: Risk measure.rf: Risk-free rate.
Constructor
ExpectedReturnRiskRatio(; rt::JuMPReturnsEstimator = ArithmeticReturn(),
rk::AbstractBaseRiskMeasure = Variance(), rf::Number = 0.0)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
[
JuMPReturnsEstimator]-(@ref)
PortfolioOptimisers.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.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
[
ArithmeticReturn]-(@ref)[
LogarithmicReturn]-(@ref)[
JuMPReturnsEstimator]-(@ref)
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
[
JuMPReturnsEstimator]-(@ref)
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
[
JuMPReturnsEstimator]-(@ref)
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
[
JuMPReturnsEstimator]-(@ref)
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
[
JuMPReturnsEstimator]-(@ref)
PortfolioOptimisers.factory Method
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...)No-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.
Related
sourcefactory(r::ExpectedReturn, args...; kwargs...)Construct a new ExpectedReturn object with an updated return estimator based on the provided prior result.
This function creates a new ExpectedReturn instance by updating the internal return estimator using the prior result and any additional arguments or keyword arguments.
Arguments
r: AExpectedReturnobject 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::ExpectedReturn: New risk measure object with updated return estimator.
Details
Calls
factoryto update the return estimator using the prior result and arguments.Returns a new
ExpectedReturnobject with the updated estimator.
Related
sourcePortfolioOptimisers.factory Method
factory(r::ExpectedReturn, args...; kwargs...)Construct a new ExpectedReturn object with an updated return estimator based on the provided prior result.
This function creates a new ExpectedReturn instance by updating the internal return estimator using the prior result and any additional arguments or keyword arguments.
Arguments
r: AExpectedReturnobject 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::ExpectedReturn: New risk measure object with updated return estimator.
Details
Calls
factoryto update the return estimator using the prior result and arguments.Returns a new
ExpectedReturnobject with the updated estimator.
Related
sourcePortfolioOptimisers.factory Method
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...)No-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.
Related
sourcefactory(r::ExpectedReturnRiskRatio, pr::AbstractPriorResult, args...; kwargs...)Construct a new ExpectedReturnRiskRatio object with updated return and risk estimators based on the provided prior result.
This function creates a new ExpectedReturnRiskRatio instance by updating the internal return estimator and risk measure using the prior result and any additional arguments or keyword arguments.
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::ExpectedReturnRiskRatio: 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
ExpectedReturnRiskRatioobject with the updated fields and original risk-free rate.
Related
sourcePortfolioOptimisers.factory Method
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...)No-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.
Related
sourcefactory(r::ExpectedReturnRiskRatio, pr::AbstractPriorResult, args...; kwargs...)Construct a new ExpectedReturnRiskRatio object with updated return and risk estimators based on the provided prior result.
This function creates a new ExpectedReturnRiskRatio instance by updating the internal return estimator and risk measure using the prior result and any additional arguments or keyword arguments.
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::ExpectedReturnRiskRatio: 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
ExpectedReturnRiskRatioobject with the updated fields and original risk-free rate.
Related
sourcePortfolioOptimisers.factory Method
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...)No-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.
Related
sourcefactory(r::ExpectedReturnRiskRatio, pr::AbstractPriorResult, args...; kwargs...)Construct a new ExpectedReturnRiskRatio object with updated return and risk estimators based on the provided prior result.
This function creates a new ExpectedReturnRiskRatio instance by updating the internal return estimator and risk measure using the prior result and any additional arguments or keyword arguments.
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::ExpectedReturnRiskRatio: 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
ExpectedReturnRiskRatioobject with the updated fields and original risk-free rate.
Related
sourcePortfolioOptimisers.factory Method
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...)No-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.
Related
sourcefactory(r::ExpectedReturnRiskRatio, pr::AbstractPriorResult, args...; kwargs...)Construct a new ExpectedReturnRiskRatio object with updated return and risk estimators based on the provided prior result.
This function creates a new ExpectedReturnRiskRatio instance by updating the internal return estimator and risk measure using the prior result and any additional arguments or keyword arguments.
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::ExpectedReturnRiskRatio: 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
ExpectedReturnRiskRatioobject with the updated fields and original risk-free rate.
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).