average_rate#

rateslib.curves.average_rate(effective, termination, convention, rate, dcf)#

Return the geometric, 1-day, average simple rate for a given simple period rate.

This is used for approximations usually in combination with floating periods.

Parameters:
  • effective (datetime) – The effective date of the rate.

  • termination (datetime) – The termination date of the rate.

  • convention (str) – The day count convention of the curve rate.

  • rate (float, Dual, Dual2) – The simple period rate to decompose to average, in percentage terms, e.g. 4.00 = 4% rate.

  • dcf (float) – The day count fraction of the period used to determine daily DCF.

Returns:

tuple

Return type:

The simple rate, the 1-day DCF, and the number of relevant days for the convention

Notes

This method operates in one of two modes to determine the value, \(\bar{r}\).

  • Calendar day basis, where \(\tilde{n}\) is calendar days in period:

    \[1+\tilde{n}\bar{d}r = (1 + \bar{d}\bar{r})^{\tilde{n}}\]
  • Business day basis (if convention is ‘bus252’), where \(n\) is business days in period. n is approximated by a 252 business days per year rule and does not calculate the exact number of business days from any specific holiday calendar.

    \[1+n\bar{d}r = (1 + \bar{d}\bar{r})^{n}\]

\(\bar{d}\), the 1-day DCF is estimated from a convention. For certain conventions, e.g. ‘act360’ and ‘act365f’ this is explicit and exact, but for others, such as ‘30360’, this function will likely be lesser used and less accurate.