Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
simontreanor committed Oct 18, 2024
1 parent 4f722c9 commit 9b4c656
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keywords: algorithm methodology amortisation amortization

Generating the amortisation starts by calling:

```PaymentSchedule.calculate```
```Scheduling.calculate```

As we're looking at an initial schedule, we don't need all the complexity of the amortisation schedule, because we don't need to look into
things like actual payments, late fees, refunds, etc. We just need to create a simple schedule that's going to let us calculate the payments
Expand Down
23 changes: 8 additions & 15 deletions docs/exampleAmortisation.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,20 @@ with a level payment of £456.88 and a final payment of £456.84:

open FSharp.Finance.Personal
open Calculation
open Currency
open DateDay
open Fee
open Charge
open PaymentSchedule
open Percentages
open Scheduling

let scheduleParameters =
{
AsOfDate = Date(2023, 4, 1)
StartDate = Date(2022, 11, 26)
Principal = 1500_00L<Cent>
PaymentSchedule = AutoGenerateSchedule {
ScheduleConfig = AutoGenerateSchedule {
UnitPeriodConfig = UnitPeriod.Monthly(1, 2022, 11, 31)
PaymentCount = 5
MaxDuration = Duration.Unlimited
}
PaymentOptions = {
PaymentConfig = {
ScheduledPaymentOption = AsScheduled
CloseBalanceOption = LeaveOpenBalance
PaymentRounding = RoundUp
Expand All @@ -55,12 +51,12 @@ let scheduleParameters =
ChargeGrouping = Charge.ChargeGrouping.OneChargeTypePerDay
LatePaymentGracePeriod = 0<DurationDay>
}
Interest = {
InterestConfig = {
Method = Interest.Method.Simple
StandardRate = Interest.Rate.Daily (Percent 0.8m)
Cap = {
Total = ValueSome (Amount.Percentage (Percent 100m, Restriction.NoLimit, RoundDown))
Daily = ValueSome (Amount.Percentage (Percent 0.8m, Restriction.NoLimit, NoRounding))
TotalAmount = ValueSome <| Amount.Percentage (Percent 100m, Restriction.NoLimit, RoundDown)
DailyAmount = ValueSome <| Amount.Percentage (Percent 0.8m, Restriction.NoLimit, NoRounding)
}
InitialGracePeriod = 3<DurationDay>
PromotionalRates = [||]
Expand All @@ -81,7 +77,7 @@ let actualPayments =

let amortisationSchedule =
actualPayments
|> Amortisation.generate scheduleParameters ValueNone ScheduleType.Original false
|> Amortisation.generate scheduleParameters ValueNone false

amortisationSchedule

Expand All @@ -91,10 +87,7 @@ amortisationSchedule
It is possible to format the `Items` property as an HTML table:
*)

let html =
amortisationSchedule
|> ValueOption.map (_.ScheduleItems >> generateHtmlFromMap None)
|> ValueOption.defaultValue ""
let html = amortisationSchedule.ScheduleItems |> Formatting.generateHtmlFromMap [||]

$"""<div style="overflow-x: auto;">{html}</div>"""

Expand Down
2 changes: 1 addition & 1 deletion docs/exampleAprUk.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following example shows a loan of £500.00 taken out on 10th October 2012 an

open FSharp.Finance.Personal
open Apr
open Currency
open Calculation
open DateDay

let startDate = Date(2012, 10, 10)
Expand Down
4 changes: 2 additions & 2 deletions docs/exampleAprUs.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following example shows a loan of $5,000.00 taken out on 10th January 1978 a

open FSharp.Finance.Personal
open Apr
open Currency
open Calculation
open DateDay
open UnitPeriod

Expand All @@ -32,7 +32,7 @@ let principal = 5000_00L<Cent>

let transfers =
Monthly (1, 1978, 2, 10)
|> generatePaymentSchedule 24 ValueNone Direction.Forward
|> generatePaymentSchedule 24 Duration.Unlimited Direction.Forward
|> Array.map(fun d -> { TransferType = Payment; TransferDate = d; Value = 230_00L<Cent> })

let aprMethod = CalculationMethod.UsActuarial 4
Expand Down
24 changes: 8 additions & 16 deletions docs/examplePaymentSchedule.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,38 @@ The following example shows the scheduled for a car loan of £10,000 taken out o
#r "nuget:FSharp.Finance.Personal"

open FSharp.Finance.Personal
open ArrayExtension
open Calculation
open Currency
open DateDay
open FeesAndCharges
open PaymentSchedule
open Percentages
open Scheduling

let scheduleParameters =
{
AsOfDate = Date(2024, 02, 07)
StartDate = Date(2024, 02, 07)
Principal = 10000_00L<Cent>
PaymentSchedule = AutoGenerateSchedule {
ScheduleConfig = AutoGenerateSchedule {
UnitPeriodConfig = UnitPeriod.Monthly(1, 2024, 3, 7)
PaymentCount = 36
MaxDuration = Duration.Unlimited
}
PaymentOptions = {
PaymentConfig = {
ScheduledPaymentOption = AsScheduled
CloseBalanceOption = LeaveOpenBalance
PaymentRounding = RoundUp
MinimumPayment = DeferOrWriteOff 50L<Cent>
PaymentTimeout = 3<DurationDay>
}
FeeConfig = Fee.Config.initialRecommended
ChargeConfig = Charge.Config.initialRecommended
Interest = {
InterestConfig = {
Method = Interest.Method.Simple
StandardRate = Interest.Rate.Annual (Percent 6.9m)
Cap = Interest.Cap.zero
InitialGracePeriod = 0<DurationDay>
PromotionalRates = [||]
RateOnNegativeBalance = Interest.Rate.Zero
}
Calculation = {
AprMethod = Apr.CalculationMethod.UnitedKingdom 3
InterestRounding = RoundDown
MinimumPayment = DeferOrWriteOff 50L<Cent>
PaymentTimeout = 3<DurationDay>
}
}

Expand All @@ -71,10 +66,7 @@ schedule
It is possible to format the `Items` property as an HTML table:
*)

let html =
schedule
|> ValueOption.map (_.Items >> generateHtmlFromArray None)
|> ValueOption.defaultValue ""
let html = schedule.Items |> Formatting.generateHtmlFromArray [||]

$"""<div style="overflow-x: auto;">{html}</div>"""

Expand Down

0 comments on commit 9b4c656

Please sign in to comment.