diff --git a/README.md b/README.md index eb873f3..2f29267 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ Initial features: > amortisation -This library operates partially in area where business is regulated by various regulators. -Though every care has been taken to ensure the accuracy of the results, please independently validate figures produced by it. +This library operates partially in areas where business is regulated by various regulators. +Though every care has been taken to ensure the accuracy of the results, please independently validate the figures produced by it. It is not audited or validated by any of the regulators. If you have any suggestions or corrections, please feel free to comment or create a pull request. diff --git a/docs/algorithms.md b/docs/algorithms.md index de30268..446be19 100644 --- a/docs/algorithms.md +++ b/docs/algorithms.md @@ -23,7 +23,7 @@ necessary to bring the final principal balance to zero. There is no formula to calculate this as it requires recursion - the interest due depends on the principal balance, the amount you pay affects how much interest is paid off (this is paid off first) and the remainder goes towards the principal, and the remaining principal determines -how must interest is due on the next payment. +how much interest is due on the next payment. So we start with a rough payment: ```(principal + interest) / paymentCount``` @@ -58,7 +58,7 @@ We now have our initial payment schedule detailing the days and amounts to be pa ### Interest caps The only other consideration in generating this initial schedule is to respect any interest caps imposed, both daily and total. For this reason -we maintain aggregate interst limits and aggregate interest amounts and compare them throughout the generation process, capping the interest where +we maintain aggregate interest limits and aggregate interest amounts and compare them throughout the generation process, capping the interest where necessary. ## Applying actual payments to the initial schedule @@ -80,7 +80,7 @@ When creating the amortisation schedule, we tie all of this information together > There are a lot of variables and the order of calculation is critical, which is what makes F# such a good choice for implementing this. Some variables are maintained in their original and modified form (typically suffixed by an apostrophe or two to make it easy to track the modifications), -and either form may be necessary throughout the algorithm. It is therefore recommended to examine the code itself if you need to see the detail. +and either form may be necessary throughout the algorithm. It is therefore recommended to examine the code itself if you need to see the details. By way of overview though, the following are performed: diff --git a/docs/exampleAprUk.fsx b/docs/exampleAprUk.fsx index af567c0..eb44ef8 100644 --- a/docs/exampleAprUk.fsx +++ b/docs/exampleAprUk.fsx @@ -42,7 +42,7 @@ solution (*** include-it ***) (** -This result is of a `Array.Solution` type. `Found` means that it was able to find a solution. +This result is of an `Array.Solution` type. `Found` means that it was able to find a solution. The APR, expressed as a decimal, is returned as the first item of the tuple. The APR is more usefully shown as a percentage, which can easily be done as follows: *) diff --git a/docs/exampleAprUs.fsx b/docs/exampleAprUs.fsx index 479e87c..1357e2c 100644 --- a/docs/exampleAprUs.fsx +++ b/docs/exampleAprUs.fsx @@ -44,7 +44,7 @@ solution (*** include-it ***) (** -This result is of a `Array.Solution` type. `Found` means that it was able to find a solution. +This result is of an `Array.Solution` type. `Found` means that it was able to find a solution. The APR, expressed as a decimal, is returned as the first item of the tuple. The APR is more usefully shown as a percentage, which can easily be done as follows: *) diff --git a/docs/index.md b/docs/index.md index 9ce33ae..d15395f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # F# Finance - Personal -FSharp.Finance.Personal is a set of functions for calculating Annual Percentage Rates (APRs) and amortisation schedules on products such as personal loans, mortgages, etc. +FSharp.Finance.Personal is a set of functions for calculating Annual Percentage Rates (APRs) and amortisation schedules for products such as personal loans, mortgages, etc. ## APRs @@ -32,4 +32,4 @@ This library is able to generate amortisation schedules based on a highly custom ### The `FSharp.Finance` family -`FSharp.Finance.Personal` covers personal finance, whereas `FSharp.Finance.Corporate` and `FSharp.Finance.Public` could potentially cover other areas of finance - anyone interested!? \ No newline at end of file +`FSharp.Finance.Personal` covers personal finance, whereas `FSharp.Finance.Corporate` and `FSharp.Finance.Public` could potentially cover other areas of finance - anyone interested!? diff --git a/src/Amortisation.fs b/src/Amortisation.fs index aa4f17f..6f95bef 100644 --- a/src/Amortisation.fs +++ b/src/Amortisation.fs @@ -129,7 +129,7 @@ module Amortisation = type Schedule = { /// a list of amortisation items, showing the events and calculations for a particular offset day ScheduleItems: Map, ScheduleItem> - /// the offset day of the final cheduled payment + /// the offset day of the final scheduled payment FinalScheduledPaymentDay: int /// the final number of scheduled payments in the schedule FinalScheduledPaymentCount: int @@ -651,7 +651,7 @@ module Amortisation = // post-process missed payments or underpayments |> markMissedPaymentsAsLate - /// wraps the amortisation schedule in some statistics, and optionally calculate the final APR (optional because it can be processor-intensive) + /// wraps the amortisation schedule in some statistics, and optionally calculates the final APR (optional because it can be processor-intensive) let calculateStats sp settlementDay (items: Map, ScheduleItem>) = let finalItemDay, finalItem = items |> Map.maxKeyValue let items' = items |> Map.toArray |> Array.map snd diff --git a/src/Scheduling.fs b/src/Scheduling.fs index b8c7edf..99ce1cb 100644 --- a/src/Scheduling.fs +++ b/src/Scheduling.fs @@ -219,7 +219,7 @@ module Scheduling = MaxDuration: Duration } - /// the type of the scheduled; for scheduled payments, this affects how any payment due is calculated + /// the type of the schedule; for scheduled payments, this affects how any payment due is calculated [] type ScheduleType = /// an original schedule @@ -363,7 +363,7 @@ module Scheduling = /// parameters for creating a payment schedule type Parameters = { - /// the date on which the schedule is inspected, typically today, but can be used to inspect it at any point (affects e.g. whether schedule payments are deemed as not yet due) + /// the date on which the schedule is inspected, typically today, but can be used to inspect it at any point (affects e.g. whether scheduled payments are deemed as not yet due) AsOfDate: Date /// the start date of the schedule, typically the day on which the principal is advanced StartDate: Date @@ -470,7 +470,7 @@ module Scheduling = |> Cent.fromDecimalCent sp.InterestConfig.InterestRounding |> Cent.min totalInterestCap | _ -> 0L - // calculate the approximate level payment value + // calculate the approximate level-payment value let calculateLevelPayment interest = if paymentCount = 0 then 0m else (decimal sp.Principal + decimal feesTotal + interest) / decimal paymentCount // create the initial item for the schedule based on the initial interest and principal // note: for simplicity, principal includes fees @@ -570,7 +570,7 @@ module Scheduling = | Solution.Bypassed -> // for the add-on interest method, now the schedule days and payment values are known, iterate through the schedule until the final principal balance is zero // note: this step is required because the initial interest balance is non-zero, meaning that any payments are apportioned to interest first, meaning that - // the principal balance is paid off more slowly than it would otherwise be; this, in turn, generates higher interest, which leads to a higher intitial interest + // the principal balance is paid off more slowly than it would otherwise be; this, in turn, generates higher interest, which leads to a higher initial interest // balance, so the process must be repeated until the total interest and the initial interest are equalised match sp.InterestConfig.Method with | Interest.Method.AddOn -> @@ -680,7 +680,7 @@ module Scheduling = previousRescheduleDay <- rescheduleDays |> Array.tryFind(fun d -> offsetDay >= d) |> toValueOption |> ValueOption.orElse previousRescheduleDay // create the modified scheduled payment match original, latestRescheduling with - // if there are any rescheduled payments, add the latest as well as the list of previously rescheduled payments on the day (also include original if any on the day) + // if there are any rescheduled payments, add the latest as well as the list of previously rescheduled payments on the day (also include the original if any on the day) | _, ValueSome r -> Some (offsetDay, { Original = original |> ValueOption.bind _.Original diff --git a/src/UnitPeriod.fs b/src/UnitPeriod.fs index e0daf4f..9df17d0 100644 --- a/src/UnitPeriod.fs +++ b/src/UnitPeriod.fs @@ -121,7 +121,7 @@ module UnitPeriod = | _ -> 0m - /// unit period combined with start date and multiple where appropriate + /// unit period combined with a start date and multiple where appropriate [] type Config = /// single on the given date