The Rate Class, Revisited¶
Now that we have introduced several types of interest rates as well as the relationships between them, it’s worth revisiting the Rate
class to appreciate more of its features.
Pattern
The types of patterns that you can supply to the rate class are:
Effective Interest
Effective Discount
Nominal Interest
Nominal Discount
Force of Interest
Simple Interest
Simple Discount
Interval
Effective Interest, Effective Discount, Simple Interest, and Simple Discount are classified internally by TmVal as “effectives.” When specifying an effective pattern, you must also supply an interval over which the rate is effective to the interval
argument. This value is usually 1, representing a 1-year rate.
Compounding Frequency
Nominal Interest and Nominal discount are classified internally as the “nominals.” When supplying a nominal pattern, you must also supply a compounding frequency to the argument freq
.
Conversions
Effective Interest, Effective Discount, Nominal Interest, Nominal Discount, and Force of Interest are classified as “compounds” and are convertible to each other.
Simple Interest and Simple Discount are classified as “simples” and are not convertible to each other because they do not correspond to the same accumulation function. You can however, use the convert_rate()
method to change the interval of a simple pattern, but not the pattern itself.
Simple patterns cannot be converted to compound patterns and vice-versa.
Standardization
Many of the TmVal’s classes, such as the previously-introduced Amount
and Accumulation
classes, as well as more complex financial instruments to be introduced later, such as the Annuity
class, will standardize a compound rate prior to performing computations.
The Rate
class has a method called standardize()
, which will convert any compound pattern to an annually compounded effective interest rate.
Shortcut Arguments
Effective Interest, Effective Discount, Simple Interest, Simple Discount, and Force of Interest can be declared by providing a single arguments i
, d
, s
, sd
, and delta
, respectively. In the case of annual Effective Interest, the most common scenario by far, you do not have to use any keyword arguments at all. Simply calling Rate(.05)
will declare an annually compounded interest rate of 5%.
Examples¶
Suppose we have a continually compound interest rate of 5%, what is the equivalent nominal discount rate compounded 6 times per year?
In [1]: from tmval import Rate
In [2]: fr = Rate(delta=.05)
In [3]: print(fr)
Pattern: Force of Interest
Rate: 0.05
In [4]: nom_d = fr.convert_rate(
...: pattern="Nominal Discount",
...: freq=6
...: )
...:
In [5]: print(nom_d)
Pattern: Nominal Discount
Rate: 0.049792244166744215
Compounding Frequency: 6 times per year
Let’s see what happens when we call standardize()
:
In [6]: i = fr.standardize()
In [7]: print(i)
Pattern: Effective Interest
Rate: 0.05127109637602412
Unit of time: 1 year
We get an annually compounded effective interest rate.