InterestRate

class quantsupport.instruments.InterestRate(rate: float, day_counter: DayCounter | str | None = ..., compounding: Compounding | str | None = ..., frequency: Frequency | str | None = ...)

An annual interest rate with the native day-count and compounding conventions.

Parameters:
  • rate (float) – Finite annual decimal rate, for example 0.06 for 6%.

  • day_counter (DayCounter or str, optional) – Day-count convention for the accrual year fraction. Default None uses Actual360.

  • compounding (Compounding or str, optional) – Rule converting the rate and accrual fraction into accumulation. Default None uses Simple.

  • frequency (Frequency or str, optional) – Compounding frequency used by the rate convention. Default None uses Annual.

Source declaration

Methods

__getitem__(key: str, /) → Any
compound_factor(start: Date | str | datetime.date, end: Date | str | datetime.date) → float
Accumulation multiplier between dates under this rate's day-count and compounding conventions.
Parameters:
  • start (Date or datetime.date or str) – Initial accumulation date; strings use ISO YYYY-MM-DD format.

  • end (Date or datetime.date or str) – Final accumulation date. The stored day counter measures the year fraction from start to end.

Returns:

Dimensionless accumulated value of one initial currency unit.

Return type:

float

discount_factor(start: Date | str | datetime.date, end: Date | str | datetime.date) → float
Discount multiplier between dates, equal to the reciprocal accumulation factor.
Parameters:
  • start (Date or datetime.date or str) – Date to which a unit payment is discounted; ISO strings are accepted.

  • end (Date or datetime.date or str) – Payment date used with start to compute the accrual year fraction.

Returns:

Dimensionless reciprocal of compound_factor(start, end).

Return type:

float

static from_dict(obj: Mapping[str, Any]) → InterestRate

Restore a native interest-rate dictionary.

Parameters:

obj (mapping) – Rate and nested rate_definition returned by to_dict().

keys() → list[str]
Return serialized field names; supports dict(obj).
to_dict() → dict[str, Any]
Return JSON-compatible fields as a dictionary.

Properties

property compounding: quantsupport.time.Compounding

Read-only rule converting the annual rate into an accumulation factor.

property day_counter: quantsupport.time.DayCounter

Read-only convention used to measure accrual between dates.

property frequency: quantsupport.time.Frequency

Read-only compounding frequency used by the rate convention.

property rate: float

Read-only annual decimal rate; 0.06 represents 6 percent.