quantlib.termstructures.yield_term_structure.YieldTermStructure

class YieldTermStructure

Bases: Observable

__init__()

Methods

__init__()

discount(self, value, bool extrapolate=False)

forward_rate(self, d1, d2, ...)

Returns the forward interest rate between two dates or times.

link_to(self, YieldTermStructure structure, ...)

time_from_reference(self, Date dt)

zero_rate(self, d, ...)

Returns the implied zero-yield rate for the given date.

Attributes

day_counter

extrapolation

max_date

max_time

reference_date

settlement_days

discount(self, value, bool extrapolate=False)
forward_rate(self, d1, d2, DayCounter day_counter=None, Compounding compounding=Compounding.Continuous, int frequency=Annual, bool extrapolate=False)

Returns the forward interest rate between two dates or times.

In the former case, times are calculated as fractions of year from the reference date. If both dates (times) are equal the instantaneous forward rate is returned.

Parameters:
  • d1 (Date or Time.) – The start date or time used to calculate the forward rate.

  • d2 (Date or Time or Period) – The end date, time or period used to calculate the forward rate.

  • day_counter (DayCounter) – The day counter used to compute the time.

  • compounding (int) – The compounding as defined in quantlib.compounding

  • frequency (int) – A frequency as defined in quantlib.time.date

  • extrapolate (bool, optional) – Default to False

time_from_reference(self, Date dt)
zero_rate(self, d, DayCounter day_counter=None, Compounding compounding=Compounding.Continuous, Frequency frequency=Annual, bool extrapolate=False)

Returns the implied zero-yield rate for the given date.

The time is calculated as a fraction of year from the reference date.

Parameters:
  • d (Date or Time) – Time or date used to calcule the zero-yield rate.

  • day_counter (DayCounter) – The day counter used to compute the time.

  • compounding (int) – The compounding as defined in quantlib.compounding

  • frequency (int) – A frequency as defined in quantlib.time.date

  • extrapolate (bool, optional) – Default to False