From 9b4c65649a091f3855fdd3d86f4bdbd4bd63846f Mon Sep 17 00:00:00 2001 From: Simon Treanor Date: Fri, 18 Oct 2024 19:48:06 +0100 Subject: [PATCH] update docs --- docs/algorithms.md | 2 +- docs/exampleAmortisation.fsx | 23 ++++++++--------------- docs/exampleAprUk.fsx | 2 +- docs/exampleAprUs.fsx | 4 ++-- docs/examplePaymentSchedule.fsx | 24 ++++++++---------------- 5 files changed, 20 insertions(+), 35 deletions(-) diff --git a/docs/algorithms.md b/docs/algorithms.md index f594ad8..de30268 100644 --- a/docs/algorithms.md +++ b/docs/algorithms.md @@ -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 diff --git a/docs/exampleAmortisation.fsx b/docs/exampleAmortisation.fsx index 1428297..19ec1be 100644 --- a/docs/exampleAmortisation.fsx +++ b/docs/exampleAmortisation.fsx @@ -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 - PaymentSchedule = AutoGenerateSchedule { + ScheduleConfig = AutoGenerateSchedule { UnitPeriodConfig = UnitPeriod.Monthly(1, 2022, 11, 31) PaymentCount = 5 MaxDuration = Duration.Unlimited } - PaymentOptions = { + PaymentConfig = { ScheduledPaymentOption = AsScheduled CloseBalanceOption = LeaveOpenBalance PaymentRounding = RoundUp @@ -55,12 +51,12 @@ let scheduleParameters = ChargeGrouping = Charge.ChargeGrouping.OneChargeTypePerDay LatePaymentGracePeriod = 0 } - 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 PromotionalRates = [||] @@ -81,7 +77,7 @@ let actualPayments = let amortisationSchedule = actualPayments - |> Amortisation.generate scheduleParameters ValueNone ScheduleType.Original false + |> Amortisation.generate scheduleParameters ValueNone false amortisationSchedule @@ -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 [||] $"""
{html}
""" diff --git a/docs/exampleAprUk.fsx b/docs/exampleAprUk.fsx index 8024008..af567c0 100644 --- a/docs/exampleAprUk.fsx +++ b/docs/exampleAprUk.fsx @@ -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) diff --git a/docs/exampleAprUs.fsx b/docs/exampleAprUs.fsx index 0f2059d..479e87c 100644 --- a/docs/exampleAprUs.fsx +++ b/docs/exampleAprUs.fsx @@ -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 @@ -32,7 +32,7 @@ let principal = 5000_00L 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 }) let aprMethod = CalculationMethod.UsActuarial 4 diff --git a/docs/examplePaymentSchedule.fsx b/docs/examplePaymentSchedule.fsx index 1e3481d..4bd21ba 100644 --- a/docs/examplePaymentSchedule.fsx +++ b/docs/examplePaymentSchedule.fsx @@ -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 - 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 + PaymentTimeout = 3 } 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 PromotionalRates = [||] RateOnNegativeBalance = Interest.Rate.Zero - } - Calculation = { AprMethod = Apr.CalculationMethod.UnitedKingdom 3 InterestRounding = RoundDown - MinimumPayment = DeferOrWriteOff 50L - PaymentTimeout = 3 } } @@ -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 [||] $"""
{html}
"""