Example #1
0
 /// <summary>Gets a interest rate with respect to a specific compounding convention.
 /// </summary>
 /// <param name="interestRate">The interest rate.</param>
 /// <param name="sourceCompounding">The compounding convention of the input <paramref name="interestRate"/>.</param>
 /// <param name="destinationCompounding">The compounding convention to convert to.</param>
 /// <param name="interestPeriodLength">The length of the interest period.</param>
 /// <returns>The interest rate in its <paramref name="destinationCompounding"/> compounding convention.</returns>
 public static double GetConvertedInterestRate(double interestRate, SimpleInterestCompounding sourceCompounding, PeriodicInterestCompounding destinationCompounding, double interestPeriodLength)
 {
     if (destinationCompounding == null)
     {
         throw new ArgumentNullException("destinationCompounding");
     }
     return((Math.Exp(Math.Log(1.0 + interestRate * interestPeriodLength) / (interestPeriodLength * destinationCompounding.PaymentsPerYear)) - 1.0) * destinationCompounding.PaymentsPerYear);
 }
Example #2
0
 /// <summary>Gets a interest rate with respect to a specific compounding convention.
 /// </summary>
 /// <param name="interestRate">The interest rate.</param>
 /// <param name="sourceCompounding">The compounding convention of the input <paramref name="interestRate"/>.</param>
 /// <param name="destinationCompounding">The compounding convention to convert to.</param>
 /// <param name="interestPeriodLength">The length of the interest period.</param>
 /// <returns>The interest rate in its <paramref name="destinationCompounding"/> compounding convention.</returns>
 public static double GetConvertedInterestRate(double interestRate, SimpleInterestCompounding sourceCompounding, ContinuouslyInterestCompounding destinationCompounding, double interestPeriodLength)
 {
     return(Math.Log(1.0 + interestRate * interestPeriodLength) / interestPeriodLength);
 }
Example #3
0
 /// <summary>Gets a interest rate with respect to a specific compounding convention.
 /// </summary>
 /// <param name="interestRate">The interest rate.</param>
 /// <param name="sourceCompounding">The compounding convention of the input <paramref name="interestRate"/>.</param>
 /// <param name="destinationCompounding">The compounding convention to convert to.</param>
 /// <param name="interestPeriodLength">The length of the interest period.</param>
 /// <returns>The interest rate in its <paramref name="destinationCompounding"/> compounding convention.</returns>
 public static double GetConvertedInterestRate(double interestRate, PeriodicInterestCompounding sourceCompounding, SimpleInterestCompounding destinationCompounding, double interestPeriodLength)
 {
     if (sourceCompounding == null)
     {
         throw new ArgumentNullException("sourceCompounding");
     }
     return((Math.Pow(1.0 + interestRate / sourceCompounding.PaymentsPerYear, interestPeriodLength * sourceCompounding.PaymentsPerYear) - 1.0) / interestPeriodLength);
 }