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
CustomExpectedReturnsValueAlgorithm: A callable the caller subtypes, which the estimator calls asval(X; dims = dims, kwargs...).Func_Num_VecNum: The scalar, the per-asset vector and the plainFunction, which this alias widens with the algorithm supertype.CustomValueExpectedReturns: The estimator whosevalfield carries this bound.
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 vectorme.val, or the result of a callableme.val.N: The number of assets, which the data matrix anddimsgive.val_sym: The name ofvalin the error messages.
Validation
isa(val, VecNum), or the function raises anArgumentError. A scalar, a function and a matrix all fail here. The message namesval_symand the type ofval.length(val) == N, or the function raises aDimensionMismatch. The message namesval_sym, the length ofval, andN.
Returns
nothing.
Related