Function ear

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

EAR - Effective Annual Rate

The effective annual rate (EAR) is the interest rate on a loan or financial product restated from the nominal interest rate with compounding taken into account. Similar behavior and usage to the EFFECT function in Excel.

The EAR is the rate actually paid or earned on an investment, loan or other financial product due to the result of compounding over a given time period.

§Arguments

  • apr - The annual percentage rate (APR, nominal interest rate)
  • npery - The number of compounding periods per year

§Returns

  • The effective annual rate (EAR)

§Example

  • APR of 5% with 12 compounding periods per year
use rust_finprim::rate::ear;
use rust_decimal_macros::*;

let apr = dec!(0.05); let npery = dec!(12);
ear(apr, npery);

§Formula

$$EAR=(1+\frac{APR}{n})^n-1$$

Where:

  • \(APR\) = annual percentage rate (nominal interest rate)
  • \(n\) = number of compounding periods per year