Custom value expected returns: private API
PortfolioOptimisers.CER_Func_Num_VecNum — Type
const CER_Func_Num_VecNum = Union{<:CustomExpectedReturnsValueAlgorithm,<:Func_Num_VecNum}Alias for supported types for the val field in CustomValueExpectedReturns.
The group exists because the three shapes are a single field's contract, not three fields. The bound is written once here, so the field, the keyword constructor and the three mean methods cannot drift apart on what val may be.
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.
Both the vector field of CustomValueExpectedReturns and the value returned by a callable val must be a vector of numbers with one element per asset. The callable is checked at the point of call, which is the only seam that can see what the callable returned.
Arguments
val: Custom value to validate. Either the storedme.valvector or the value returned by a callableme.val.N: Number of assets implied by the data matrix anddims.val_sym: Symbolic name used in the error messages.
Validation
isa(val, VecNum), or anArgumentErroris thrown. A scalar, a function and a matrix all fail here, and the message namesval_symand the type it was given.length(val) == N, or aDimensionMismatchis thrown. The message namesval_sym, the length it was given, andN.
Returns
nothing.
Related