summaryrefslogtreecommitdiff
path: root/src/FundLab.Api/BondQuoteProbe.fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/FundLab.Api/BondQuoteProbe.fs')
-rw-r--r--src/FundLab.Api/BondQuoteProbe.fs14
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
}