G-Cubed
Python G-Cubed 5.0.2.0 · build 1
Generation details
Source revision
4c4a95aded1b5ca5e8f9c292ad8250440cd9c18b (modified inputs)
Source fingerprint
e2c719b38e03c6b1748f10e26bc1caf1ead5674dd1beee6628a6ccf7b90fd39b
Generated (UTC)
2026-11-11T03:06:22.844261+00:00
Generator
pdoc 16.0.0, CPython 3.14.8
Generation metadata

gcubed.projections.yield_curves

This module contains the 'YieldCurves class, responsible for computing long bond rates in nominal and real yield curves from projections of 1-year rates.

class YieldCurves:

Provides the functionality required to compute long nominal and real interest rates from one-year rates.

@classmethod
def calculate_long_rates(cls, term: int, rates: pandas.DataFrame) -> pandas.DataFrame:

Overview

Utility method that returns the compounding long rates given the yearly rates.

Arguments

term: the number of years of the term of the instrument. 2 for a 2 year bond. Valid values are:

  • 2 (for nominal short rates only)
  • 5 (for nominal short rates only)
  • 10 (for real or nominal short rates)

rates: a dataframe with a single row, containing the 1 year interest rates (nominal or real) across the columns. The row index is the variable name of the 1 year interest rate. The column indices are ordered YYYY years (as strings). Rates are interpreted as decimal values so 1% is expected to be given as 0.01.

Returns the long rates that can be computed from the one year rates. This series is shorter than the series of one year rates because the required data is not available for the last (term-1) observations. It is padded with NaN values in the returned dataframe. An annual rate below -100% makes only the maturity windows containing that quote undefined. Later valid windows are calculated independently. An exactly -100% quote gives a zero gross return in its own windows.