Prices result: private API

Functions

PortfolioOptimisers.assert_nonneg_where_present — Function
assert_nonneg_where_present(val::AbstractArray, sym::Union{Symbol, AbstractString} = :val) -> nothing

Refuse a negative or an infinite value, and let an absence through.

The ingestion layer carries an absent implied volatility as NaN, as it carries an absent price, and the PricesResult and the ReturnsResult accept it. ImpliedVolatility reads the series from a PricesResult or a ReturnsResult, and narrows its Coverage Universe to the assets whose values are complete. So an absent value removes the asset from the fit, and the fit does not fail. The PricesResult or the ReturnsResult refuses a present value that is not a volatility, which is a negative value or an infinite one. An infinite value is neither a volatility nor the marker of an absence. assert_cross_sectional_matrix applies the same rule to a returns matrix. A PricesResult or a ReturnsResult built by hand can also hold missing, and this check accepts it as an absence too. prices_to_returns changes each missing to NaN before an estimator reads the series.

Arguments

  • val: The array to check.
  • sym: Symbolic name used in the error message.

Validation

  • Every element is missing, NaN, or finite and non-negative. A breach raises a DomainError.

Returns

  • nothing.

Related

source