Skip to content

yield_curve_service

Classes:

  • YieldCurveService

    Service to convert par yields into zero yield curves using QuantLib.

YieldCurveService

Service to convert par yields into zero yield curves using QuantLib.

Methods:

build_yield_curve staticmethod

build_yield_curve(
    ref_date: date, maturity_labels: list, rates: list
) -> YieldTermStructure

Construct a QuantLib yield curve from provided maturity labels and rates.

:param ref_date: Reference date (Python datetime.date) :param maturity_labels: List of column names corresponding to maturities (e.g., ["1 Mo", "2 Yr"]) :param rates: List of yield values corresponding to the maturities (in percentage, e.g., [2.5, 3.0, 3.5]) :return: QuantLib Piecewise Log-Cubic Discount yield curve

build_yield_curve_from_df classmethod

build_yield_curve_from_df(
    df: DataFrame, date: date
) -> YieldTermStructure

Construct a QuantLib yield curve from a DataFrame and a specific date.

:param df: DataFrame containing yield data with a 'date' column and maturity columns :param date: Specific date to extract the yield data :return: QuantLib YieldTermStructure