Exemplo n.º 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, ContinuouslyInterestCompounding sourceCompounding, PeriodicInterestCompounding destinationCompounding, double interestPeriodLength)
 {
     if (destinationCompounding == null)
     {
         throw new ArgumentNullException("destinationCompounding");
     }
     return((Math.Exp(interestRate / destinationCompounding.PaymentsPerYear) - 1.0) * destinationCompounding.PaymentsPerYear);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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, ContinuouslyInterestCompounding destinationCompounding, double interestPeriodLength)
 {
     if (sourceCompounding == null)
     {
         throw new ArgumentNullException("sourceCompounding");
     }
     return(sourceCompounding.PaymentsPerYear * Math.Log(1.0 + interestRate / sourceCompounding.PaymentsPerYear));
 }