FinanceModels.Fit API Reference
Exported API
Unexported API
FinanceModels.Fit.Bootstrap — Type
Bootstrap()A singleton type passed to fit to bootstrap a spline curve one quote at a time. Each step solves for the zero rate at the next quote maturity to match its price.
Supports Spline.Linear() (equivalently Spline.PolynomialSpline(1) or Spline.BSpline(1)). Bootstrapping requires that adding a knot on the right leaves every earlier curve segment unchanged, so earlier quotes stay exactly priced. Linear interpolation of zero rates has this property; quadratic, cubic, higher-order B-spline, PCHIP, and Akima interpolation do not, because a later knot changes the shape of earlier segments. Fit those strategies across the complete quote set with Fit.Loss(x -> x^2), and fit a monotone convex curve with fit(Spline.MonotoneConvex(), quotes).
After solving, every quote is repriced on the returned curve; a residual beyond root-finder precision throws an ArgumentError naming the quote.
A subtype of FitMethod.
Examples
quotes = ZCBPrice([0.99, 0.97, 0.94])
curve = fit(Spline.Linear(), quotes, Fit.Bootstrap())
discount(curve, 2) ≈ 0.97 # trueFinanceModels.Fit.Loss — Type
Fit.Loss(function)function should be a loss measure, such as x->x^2 or x->abs(x). This is used by the optimization algorithm in fit to determine optimal parameters as defined by this loss function.
A subtype of FitMethod.
Examples
julia> mod0 = Yield.Constant();
julia> quotes = ZCBPrice([0.9, 0.8, 0.7,0.6]);
julia> fit(mod0,quotes,Fit.Loss(x->x^2))
FinanceModels.Yield.Constant{Rate{Float64, Periodic}}(Periodic(0.12822921882254446, 1))(With UnicodePlots loaded, fitted yield models display as a zero-rate chart instead.)
Please open an issue if you encounter any issues or confusion with the package.