diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 08:07:00 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 08:07:00 +0800 |
| commit | b05e728ae23d088ca6c9ecccf6ed00d2ab6f3839 (patch) | |
| tree | 4846648aa87263742c1181c189287b53c3bf84de /src/FundLab.Api/BondQuoteProbe.fs | |
| parent | 27a85d9070abd000245b2a2e6460ddf9fd5eb97e (diff) | |
| download | fund-lab-b05e728ae23d088ca6c9ecccf6ed00d2ab6f3839.tar.gz | |
Add bond full milestone: profile probe, coupon/accrual rules, ledger and point-in-time valuation (3d-29)
Diffstat (limited to 'src/FundLab.Api/BondQuoteProbe.fs')
| -rw-r--r-- | src/FundLab.Api/BondQuoteProbe.fs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/FundLab.Api/BondQuoteProbe.fs b/src/FundLab.Api/BondQuoteProbe.fs index 311dec5..b01ff18 100644 --- a/src/FundLab.Api/BondQuoteProbe.fs +++ b/src/FundLab.Api/BondQuoteProbe.fs @@ -17,8 +17,42 @@ type BondQuote = AccruedInterest: decimal option Date: DateOnly option MaturityDate: DateOnly option + ParValue: decimal option + IssuePrice: decimal option + ValueDate: DateOnly option + ListingDate: DateOnly option + PublishDate: DateOnly option + PayInterestDay: string option + CouponRate: decimal option + CouponRateExplain: string option + BondExpireYears: string option + Rating: string option + DataStatus: string option } +module BondQuote = + open FundLab.Domain + + /// Best-effort conversion of a quote into pricing terms. Requires the value + /// date, maturity and coupon rate; when any is missing the caller gets None + /// rather than a fabricated coupon. Exchange convertible bonds pay annually + /// (a single 付息日), so the frequency defaults to 1. + let tryTerms (quote: BondQuote) : BondTerms option = + match quote.ValueDate, quote.MaturityDate, quote.CouponRate with + | Some valueDate, Some maturityDate, Some couponRate -> + Some( + BondTerms.create + (defaultArg quote.ParValue 100m) + couponRate + 1 + valueDate + maturityDate + 10m + 0 + 0m + ) + | _ -> None + /// Read-only probe that returns the current quote for a bond code. /// /// Like INavDateProbe there is no synthetic fallback: a failed probe surfaces as @@ -70,6 +104,17 @@ type AkshareBondQuoteProbe(collector: IMarketDataCollector) = AccruedInterest = payload.AccruedInterest Date = payload.Date MaturityDate = payload.MaturityDate + ParValue = payload.ParValue + IssuePrice = payload.IssuePrice + ValueDate = payload.ValueDate + ListingDate = payload.ListingDate + PublishDate = payload.PublishDate + PayInterestDay = payload.PayInterestDay + CouponRate = payload.CouponRate + CouponRateExplain = payload.CouponRateExplain + BondExpireYears = payload.BondExpireYears + Rating = payload.Rating + DataStatus = payload.DataStatus } cache.[normalized] <- quote |
