Internal 4-type dispatcher used by fit_ratio(), fit_loss(), and
backtest() to normalize the maturity input into a single
representation: either NULL (no maturity override) or a
"Maturity" object.
The four accepted input types are:
NULLReturns
NULL– caller falls back to its default maturity behavior."Maturity"objectReturned as-is.
"auto"Runs
detect_maturity()onmasked_triif supplied, otherwise ontri. Themasked_trifallback is the leakage-safe path used bybacktest()– fit functions pass onlytri, whilebacktest()passes both so detection sees only the masked (training) data.function(tri) -> MaturityClosure invoked with
masked_tri(if non-NULL) ortri. Its return value must inherit"Maturity"; an error is raised otherwise.
Arguments
- arg
The maturity input (NULL / Maturity /
"auto"/ function).- tri
A
"Triangle"object – used as the detection input whenmasked_triisNULL.- masked_tri
Optional masked
"Triangle"(e.g. backtest's training-only triangle). When supplied,"auto"and function inputs operate on this triangle instead oftri.
