Add Trade Credit & Invoice Factoring Extensions (B2B analytics) #30
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
This PR introduces the initial Business (B2B) analytical extensions under the namespace
FSharp.Finance.B2B.*.Purpose: provide optional analytics (NOT a full commercial / operational platform) for:
Files Added (Current State)
DomainExtensions.fsBusinessProductTypeDUProductMetadatarecord + helper constructors (consumer,tradeCredit,invoiceFactoring)CashflowModel.fsCashflowTypeDU +CashflowEventrecord (future-facing abstraction; not yet wired in)TradeCredit.fsDiscountTerms,createTermsimpliedAnnualRateSimpleimpliedAnnualRateCompoundedInvoiceFactoring.fsInvoice,InvoiceAdvance(derive)FactoringParameters.build→(Parameters * InvoiceAdvance list)docs/exampleTradeCreditAndFactoring.fsxDesign Decisions
FSharp.Finance.B2B.*Apr.CalculationMethod.UnitedKingdom 2(placeholder)Trade Credit Rate Formulas
Let
d = discountPercent,D = discount deadline day,N = net due day.Simple annualized (no intra-year compounding):
rate_simple = (d / (1 - d)) * (365 / (N - D))Naive compounded:
rate_compounded = (1 + d / (1 - d))^(floor(365 / (N - D))) - 1Comments in code document rationale and limitations.
Documentation Example
docs/exampleTradeCreditAndFactoring.fsx:Tests (Planned / Needed)
TradeCreditTests.fsimpliedAnnualRateSimplefor 2/10 net 30 ≈ 0.3724 (tolerance ±0.0001m)Checklist
Open Questions
AprMethod.Disabledin a future minor version for zero-interest cases?CashflowModel)?FSharp.Finance.Analyticsnamespace (backward-compatible duplication)?Non-Goals (Current Iteration)
Disclaimer
Analytical utilities only. Independent validation required for production or compliance use.