diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 03:48:12 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 03:48:12 +0800 |
| commit | b5a80f69cb2e2793e5134e23a0eb3e72cdbdbe0b (patch) | |
| tree | eeb22106ceb0d1eb0fe07b7bff18450af11e0d50 /src/FundLab.Api/BondQuoteProbe.fs | |
| parent | 7dd0e3f42105569b6e6ec02aeeec9b5a8bbd9dd3 (diff) | |
| download | fund-lab-b5a80f69cb2e2793e5134e23a0eb3e72cdbdbe0b.tar.gz | |
Add multi-source bond quote probe fields and daily fallback (3d-20)
Diffstat (limited to 'src/FundLab.Api/BondQuoteProbe.fs')
| -rw-r--r-- | src/FundLab.Api/BondQuoteProbe.fs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/FundLab.Api/BondQuoteProbe.fs b/src/FundLab.Api/BondQuoteProbe.fs index 0cb7c3b..311dec5 100644 --- a/src/FundLab.Api/BondQuoteProbe.fs +++ b/src/FundLab.Api/BondQuoteProbe.fs @@ -10,8 +10,12 @@ open System.Threading type BondQuote = { Code: string + SourceRevision: string Name: string option Price: decimal option + CleanPrice: decimal option + AccruedInterest: decimal option + Date: DateOnly option MaturityDate: DateOnly option } @@ -49,12 +53,22 @@ type AkshareBondQuoteProbe(collector: IMarketDataCollector) = | Ok json -> match MarketData.parseBondQuotePayload json with | Error message -> Error(InvalidMarketDataPayload message) + | Ok payload when not (String.Equals(payload.Code, normalized, StringComparison.Ordinal)) -> + Error( + InvalidMarketDataPayload( + sprintf "payload code '%s' does not match requested code '%s'" payload.Code normalized + ) + ) | Ok payload -> let quote = { Code = payload.Code + SourceRevision = payload.SourceRevision Name = payload.Name Price = payload.Price + CleanPrice = payload.CleanPrice + AccruedInterest = payload.AccruedInterest + Date = payload.Date MaturityDate = payload.MaturityDate } |
