Function rust_finprim::rate::apr

source ·
pub fn apr(ear: Decimal, npery: Decimal) -> Decimal
Expand description

APR - Annual (Nominal) Percentage Rate

Calculated from the effective interest rate and the number of compounding periods per year. Similar behavior and usage to the NOMINAL function in Excel.

The APR is the annualized interest rate that you are charged on your loan. It is expressed as a percentage that represents the actual yearly cost of funds over the term of a loan. This includes any fees or additional costs associated with the transaction but does not take compounding into account.

§Arguments

  • ear - The effective interest rate (EAR)
  • npery - The number of compounding periods per year

§Returns

  • The annual percentage rate (nominal interest rate)

§Example

  • EAR of 5% with 12 compounding periods per year
use rust_finprim::rate::apr;
use rust_decimal_macros::*;
let ear = dec!(0.05); let npery = dec!(12);
apr(ear, npery);

§Formula

$$APR=n(\sqrt[n]{1+EAR}-1)$$

Where:

  • \(n\) = number of compounding periods per year
  • \(EAR\) = effective annual Rate