Money.Financial.interest_rate

You're seeing just the function interest_rate, go back to Money.Financial module for more information.
Link to this function

interest_rate(present_value, future_value, periods)

View Source

Specs

interest_rate(Money.t(), Money.t(), number()) :: Decimal.t()

Calculates the effective interest rate for a given present value, a future value and a number of periods.

  • present_value is a %Money{} representation of the present value

  • future_value is a %Money{} representation of the future value

  • periods is an integer number of a period

Examples

iex> Money.Financial.interest_rate Money.new(:USD, 10000), Money.new(:USD, 10816), 2
#Decimal<0.04>

iex> Money.Financial.interest_rate Money.new(:USD, 10000), Money.new(:USD, "10824.3216"), 4
#Decimal<0.02>