Consolidated Equipment Finance Domain added: Loans, Leases, US MACRS, UK Capital Allowances#32
Open
Thorium wants to merge 7 commits into
Open
Consolidated Equipment Finance Domain added: Loans, Leases, US MACRS, UK Capital Allowances#32Thorium wants to merge 7 commits into
Thorium wants to merge 7 commits into
Conversation
Co-authored-by: Thorium <229355+Thorium@users.noreply.github.com>
…d leases Co-authored-by: Thorium <229355+Thorium@users.noreply.github.com>
Co-authored-by: Thorium <229355+Thorium@users.noreply.github.com>
1) Use consistently int64<Cent> and remove roundings 2) Fix some tests
There was a problem hiding this comment.
Pull request overview
Adds a new FSharp.Finance.Personal.EquipmentFinance domain that bundles equipment loans, leases, and simplified US/UK depreciation models, along with docs and baseline tests.
Changes:
- Introduces new Equipment Finance modules: Loans, Leases, US MACRS, UK Capital Allowances, plus shared depreciation utilities.
- Adds new test suites for the new modules and wires them into the test project.
- Updates documentation/examples and adds minor DU-case argument naming improvements in existing core modules.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| src/FSharp.Finance.Personal.fsproj | Adds Equipment Finance source files to compilation. |
| src/EquipmentFinance/Depreciation/DepreciationCommon.fs | Shared depreciation utilities (SL/DB schedules, rounding, validation, disclaimers). |
| src/EquipmentFinance/Depreciation/US_MACRS.fs | Simplified MACRS tables + schedule generation + examples. |
| src/EquipmentFinance/Depreciation/UK_CapitalAllowances.fs | Simplified UK AIA+WDA schedule generator + examples. |
| src/EquipmentFinance/Loan.fs | Equipment loan payment, schedule, and MACRS-linked analysis. |
| src/EquipmentFinance/Lease.fs | Equipment lease payment, PV, schedules, and lease-vs-buy analysis. |
| src/Scheduling.fs | Adds named fields to DU cases for clarity. |
| src/Interest.fs | Adds named fields to Rate DU cases. |
| src/Fee.fs | Adds named fields to FeeType DU cases. |
| src/Amortisation.fs | Removes an attribute from OffsetDayType module. |
| tests/FSharp.Finance.Personal.Tests.fsproj | Includes new Equipment Finance test files. |
| tests/DepreciationCommonTests.fs | Tests for shared depreciation utilities and rounding invariants. |
| tests/USMacrsTests.fs | Tests for MACRS recovery periods, tables, and schedules. |
| tests/UKCapitalAllowancesTests.fs | Tests for AIA/WDA schedules and default config. |
| tests/EquipmentLoanTests.fs | Tests for loan payment/details/schedule + depreciation integration. |
| tests/EquipmentLeaseTests.fs | Tests for lease payment/details/schedules + depreciation integration. |
| docs/EquipmentFinanceExamples.fsx | Usage examples script (mostly illustrative output). |
| docs/EquipmentFinance.md | High-level documentation for the new modules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+42
to
+43
| | HalfYear // half-year convention (most common) | ||
| | MidQuarter // mid-quarter convention (when over 40% of assets placed in service in Q4) |
There was a problem hiding this comment.
Convention includes MidQuarter, but the implementation uses only half-year tables and doesn't check asset.Convention. Since the module is documented as half-year only, consider rejecting MidQuarter explicitly (e.g., invalidArg) or removing it to avoid silently incorrect results.
Suggested change
| | HalfYear // half-year convention (most common) | |
| | MidQuarter // mid-quarter convention (when over 40% of assets placed in service in Q4) | |
| | HalfYear // only supported convention in this module |
Correct lease and loan schedule edge cases, tighten validation, and align depreciation rounding behavior with the documented simplified models.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Single coherent Equipment Finance feature set:
int64<Cent>, MidpointRounding.AwayFromZero)No public API breaking changes to existing non‑equipment modules.
Modules Included
Namespace root:
FSharp.Finance.Personal.EquipmentFinanceDepreciation:
DepreciationCommon.fs(shared types/helpers)US_MACRS.fs(simplified MACRS Half-Year convention, limited classes)UK_CapitalAllowances.fs(AIA allocation + WDA diminishing balance 18% / 6%)Financing:
Loan.fs(EquipmentLoanTerms, schedule generator, balloon handling, fees)Lease.fs(EquipmentLeaseTerms, rental schedule generator, total cost helper)Depreciation Simplifications
US MACRS (Simplified)
UK Capital Allowances (Simplified)
Loan Scope
Implemented:
Not Implemented (TODO):
Lease Scope
Implemented:
Not Implemented (TODO):
Tests Added
Documentation Changes
Added / Updated:
docs/equipmentFinanceOverview.md(Loans, Leases, US & UK depreciation)docs/equipmentFinanceUsMacrs.md(simplifications + TODO)docs/equipmentFinanceUk.md(simplifications + TODO)docs/BUSINESS_CASES_INDEX.md(marks Equipment Finance as implemented, notes “simplified”)All docs emphasize: analytical-only; not financial / tax / accounting advice.
Rounding & Monetary Consistency
int64<Cent>Cent.fromDecimalCent MidpointRounding.AwayFromZeroBackwards Compatibility
Next Steps (Proposed Roadmap)
Validation Checklist
dotnet buildsucceedsdotnet testpassesLicense / Disclaimer
Analytical-only computations. Not tax, legal, accounting, or financial advice. Users must verify applicability and compliance independently.