Skip to content
11

Expected Returns

Public

PortfolioOptimisers.ExpectedReturn Type
julia
struct ExpectedReturn{T1} <: NonOptimisationRiskMeasure
    rt::T1
end

Return-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

julia
ExpectedReturn(; rt::JuMPReturnsEstimator = ArithmeticReturn())

Examples

julia
julia> ExpectedReturn()
ExpectedReturn
  rt ┼ ArithmeticReturn
     │   ucs ┼ nothing
     │    lb ┼ nothing
     │    mu ┴ nothing

Related

source
PortfolioOptimisers.ExpectedReturnRiskRatio Type
julia
struct ExpectedReturnRiskRatio{T1, T2, T3} <: NonOptimisationRiskMeasure
    rt::T1
    rk::T2
    rf::T3
end

Ratio-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

julia
ExpectedReturnRiskRatio(; rt::JuMPReturnsEstimator = ArithmeticReturn(),
                 rk::AbstractBaseRiskMeasure = Variance(), rf::Number = 0.0)

Examples

julia
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.0

Related

source
PortfolioOptimisers.expected_risk Function
julia
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: ExpectedReturn containing 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

source
PortfolioOptimisers.expected_risk Function
julia
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: ExpectedReturnRiskRatio containing 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

source

Private

PortfolioOptimisers.expected_return Function
julia
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_return is broadcast over the vector of vectors of portfolio weights.

Related

source
PortfolioOptimisers.expected_ratio Function
julia
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

source
PortfolioOptimisers.expected_risk_ret_ratio Function
julia
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

source
PortfolioOptimisers.expected_sric Function
julia
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

source
PortfolioOptimisers.expected_risk_ret_sric Function
julia
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 matrix X).

  • 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

source
PortfolioOptimisers.factory Method
julia
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

source
julia
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: A ExpectedReturn object 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 factory to update the return estimator using the prior result and arguments.

  • Returns a new ExpectedReturn object with the updated estimator.

Related

source
PortfolioOptimisers.factory Method
julia
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: A ExpectedReturn object 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 factory to update the return estimator using the prior result and arguments.

  • Returns a new ExpectedReturn object with the updated estimator.

Related

source
PortfolioOptimisers.factory Method
julia
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

source
julia
factory(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 ExpectedReturnRiskRatio object with the updated fields and original risk-free rate.

Related

source
PortfolioOptimisers.factory Method
julia
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

source
julia
factory(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 ExpectedReturnRiskRatio object with the updated fields and original risk-free rate.

Related

source
PortfolioOptimisers.factory Method
julia
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

source
julia
factory(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 ExpectedReturnRiskRatio object with the updated fields and original risk-free rate.

Related

source
PortfolioOptimisers.factory Method
julia
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

source
julia
factory(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 ExpectedReturnRiskRatio object with the updated fields and original risk-free rate.

Related

source
PortfolioOptimisers.brinson_attribution Function
julia
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 in asset_classes specifying 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 date0 and date1.

  • 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).
source