Custom value expected returns: private API

PortfolioOptimisers.CER_Func_Num_VecNum — Type
const CER_Func_Num_VecNum = Union{CustomExpectedReturnsValueAlgorithm,Func_Num_VecNum}

Alias for the types that the val field of CustomValueExpectedReturns accepts.

The three shapes of val are a scalar, a per-asset vector and a callable. The keyword constructor and the checked positional constructor take this bound. The three mean methods dispatch on the shape, each on its own bound.

Related

source
PortfolioOptimisers.assert_custom_expected_returns_val — Function
assert_custom_expected_returns_val(val, N::Integer)
assert_custom_expected_returns_val(
    val,
    N::Integer,
    val_sym::Union{AbstractString, Symbol}
)

Assert that a custom expected returns value is a per-asset vector of the expected length.

The vector field of CustomValueExpectedReturns and the result of a callable val must both be a vector of numbers with one element per asset. mean checks the result of a callable after it calls it, because no earlier step can see that result.

Arguments

  • val: The custom value to check. It is the stored vector me.val, or the result of a callable me.val.
  • N: The number of assets, which the data matrix and dims give.
  • val_sym: The name of val in the error messages.

Validation

  • isa(val, VecNum), or the function raises an ArgumentError. A scalar, a function and a matrix all fail here. The message names val_sym and the type of val.
  • length(val) == N, or the function raises a DimensionMismatch. The message names val_sym, the length of val, and N.

Returns

  • nothing.

Related

source