Rate(PeriodCount: Integer;
PeriodPayment: Double;
PresentValue: Double;
FutureValue: Double;
Type: Integer;
Guess: Double): Double;
Rate(PeriodCount: integer;
PeriodPayment: double;
PresentValue: double;
FutureValue: double;
Type: integer;
Guess: double): double;
| Parameters | Description | Constraints |
| PeriodCount | Total number of annuity payment periods. | Must be positive. |
| PeriodPayment | The payment made each period; this value cannot change during the whole payments period. | Must have the sign different from PresentValue. |
| PresentValue | Present value or total sum that at the moment is equal to the future payments. | Must have the sign different from PeriodPayment. |
| FutureValue | Value of the future value, that is, the desired remainder after the last payment. | |
| Type | Selecting time of payment: 0 - in the end of the period. 1 - in the beginning of the period. |
Must take the values 0 or 1. |
| Guess | Supposed interest rate. |
The Rate method returns annual interest rate for one period.
Rate is calculated by converging iteration process, that is why if consequent results of the Rate function are not equal with the accuracy up to 0,0000001, Rate returns error message.
If the Rate function does not converge, try to change value of the Guess parameter. The Rate function usually converges if value of this parameter is set between 0 and 1.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: String;
Begin
r := CultureInfo.Current.FormatDoublePrec(Finance.Rate(48, -200, 8000, 0, 0, 0.01), 2);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the interest rate equal to 0.01 or 1%.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.MathFin;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
r: String;
Finance: FinanceClass = New FinanceClass();
CultInf: CultureInfoClass = New CultureInfoClass();
Begin
r := CultInf.Current.FormatDoublePrec(Finance.Rate(48, -200, 8000, 0, 0, 0.01), 2);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: