Yield Curve Calibration¶
quantflow.rates.calibration.YieldCurveCalibration
pydantic-model
¶
Bases: BaseModel, Generic[Y]
Fields:
-
yield_curve(Y)
get_params
abstractmethod
¶
set_params
abstractmethod
¶
get_bounds
abstractmethod
¶
prepare
¶
Hook called before optimisation with the observation times to maturity.
By default it does nothing. Curves whose parameters depend on the observation grid, such as interpolated curves, use it to seed their nodes.
| PARAMETER | DESCRIPTION |
|---|---|
ttm
|
Observation times to maturity in years
TYPE:
|
Source code in quantflow/rates/calibration.py
calibrate
abstractmethod
¶
Fit the yield curve to continuously compounded rates.
| PARAMETER | DESCRIPTION |
|---|---|
ttm
|
Times to maturity in years.
TYPE:
|
rates
|
Continuously compounded rates, same length as ttm.
TYPE:
|
Source code in quantflow/rates/calibration.py
calibrate_df
¶
Fit the yield curve to target discount factors.
Converts discount factors to continuously compounded rates then calls calibrate.
| PARAMETER | DESCRIPTION |
|---|---|
ttm
|
Times to maturity in years.
TYPE:
|
target
|
Target discount factors, same length as ttm.
TYPE:
|
Source code in quantflow/rates/calibration.py
calibrate_historical_rates_dataframe
¶
Fit the yield curve from a historical panel of rates.
Tenor column labels are parsed into times to maturity, per-step
time increments are inferred from the DatetimeIndex (irregular
spacing supported), and rates are converted to continuously
compounded if a finite frequency is supplied. The actual fit
is delegated to [calibrate_historical_rates][quantflow.rates.calibration.calibrate_historical_rates],
which subclasses override.
| PARAMETER | DESCRIPTION |
|---|---|
rates
|
Historical zero rates with a DatetimeIndex and tenor column labels parsed by [ccy.Period][ccy.dates.period.Period] (e.g.
TYPE:
|
frequency
|
Compounding periods per year of the input rates.
TYPE:
|
Source code in quantflow/rates/calibration.py
calibrate_historical_rates
¶
Model-specific hook for historical rate calibration.
Default implementation raises NotImplementedError. Subclasses with a stochastic short-rate dynamic override this method.
| PARAMETER | DESCRIPTION |
|---|---|
ttm
|
Times to maturity in years.
TYPE:
|
rates
|
Continuously compounded rates, same shape as ttm.
TYPE:
|
dt
|
Time increments between observations, same length as rates.
TYPE:
|
Source code in quantflow/rates/calibration.py
quantflow.rates.calibration.OptionsDiscountingCalibration
dataclass
¶
Calibrate yield curves from option price parity data.
The input data consists of arrays of call-put parity values, strikes, and times to maturity for a set of options on the same underlying. The calibration can be done jointly for both the asset and quote curves, or separately for one curve with the other fixed.
asset_curve
instance-attribute
¶
Yield curve for the underlying asset. An instance is treated as fixed; a YieldCurveCalibration will be calibrated from the parity data.
quote_curve
instance-attribute
¶
Yield curve for the quote asset. An instance is treated as fixed; a YieldCurveCalibration will be calibrated from the parity data.
calibrate
¶
Source code in quantflow/rates/calibration.py
joint_calibration
¶
Calibrate both curves jointly from all parity observations.
Source code in quantflow/rates/calibration.py
asset_calibration
¶
Calibrate only the asset curve; quote curve is fixed.
Source code in quantflow/rates/calibration.py
quote_calibration
¶
Calibrate only the quote curve; asset curve is fixed.