Converting between the different ways an interest rate can be quoted.
A nominal rate paired with a compounding frequency, the effective annual rate it actually earns, and a continuously-compounded rate all describe the same return in different terms. These functions move between them.
Summary
Functions
The per-period rate equivalent to a continuously-compounded annual rate, for
periods periods a year.
Same as continuous_to_periodic/2, but returns the rate directly and raises ArgumentError on error.
The effective annual rate earned by a nominal rate compounded m times a year.
Same as effective_annual_rate/2, but returns the rate directly and raises ArgumentError on error.
The nominal rate that, compounded m times a year, produces the effective
annual rate. The inverse of effective_annual_rate/2.
Same as nominal_rate/2, but returns the rate directly and raises ArgumentError on error.
Types
@type error() :: Finance.error()
Functions
The per-period rate equivalent to a continuously-compounded annual rate, for
periods periods a year.
e^(rate / periods) − 1
iex> {:ok, r} = Finance.Rates.continuous_to_periodic(0.10, 1)
iex> Float.round(r, 6)
0.105171
Same as continuous_to_periodic/2, but returns the rate directly and raises ArgumentError on error.
The effective annual rate earned by a nominal rate compounded m times a year.
(1 + nominal / m)^m − 1
iex> {:ok, ear} = Finance.Rates.effective_annual_rate(0.10, 12)
iex> Float.round(ear, 6)
0.104713
Same as effective_annual_rate/2, but returns the rate directly and raises ArgumentError on error.
The nominal rate that, compounded m times a year, produces the effective
annual rate. The inverse of effective_annual_rate/2.
m · ((1 + effective)^(1/m) − 1)
iex> {:ok, ear} = Finance.Rates.effective_annual_rate(0.10, 12)
iex> {:ok, nominal} = Finance.Rates.nominal_rate(ear, 12)
iex> Float.round(nominal, 10)
0.1
Same as nominal_rate/2, but returns the rate directly and raises ArgumentError on error.