From 67d7733ed6f7e148ff520bc1d73868fb1f8eed59 Mon Sep 17 00:00:00 2001 From: hjhan Date: Fri, 14 Aug 2026 08:14:32 +0800 Subject: [PATCH] =?UTF-8?q?docs(margin):=20=E4=BF=AE=E6=AD=A3=20CalcMargin?= =?UTF-8?q?Interest=20remarks=E2=80=94=E2=80=94SwapIntervalList=20?= =?UTF-8?q?=E5=8D=95=E6=AE=B5=E6=98=AF=E4=BF=9D=E8=AF=81=E9=87=91=E6=9C=AC?= =?UTF-8?q?=E6=80=A7=E8=80=8C=E9=9D=9E=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第2点措辞修正:原写"SwapIntervalList 必须单段(多段会漏分段)"误导,把业务本性误述成代码限制。 实际:保证金=固定利率(业务定义),SwapIntervalList 多段是融资腿 FR007 概念与保证金无关; CalcMarginInterest 只消费 rate(GetFixedRate 已处理分段),不直接读 SwapIntervalList, 单段 segmentRates 是对固定利率的正确建模。纯注释,零行为变化。 --- YLErpDAL/Modules/SwapModule/SwapDealService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 96648fc4..cd3b8d70 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -954,11 +954,13 @@ namespace YLErp.Modules.SwapModule /// (融资腿 orginPv=浮动端名义本金)。保留累计语义(priorAccrued + 增量),满足下游字段契约。 /// /// - /// 隐式假设(违反会静默算错、无 assert 防护——由前端保证金表单保证;诊断时先核对这两条): - /// 1. InterestType 必须为单利。本方法恒走 SimpleInterestAccrual 单利,不查 InterestType; - /// 若库内 InterestMode=5/6 且 InterestType=复利(脏数据),会与旧 CalcEodInterest 的复利分支不一致。 - /// 2. SwapIntervalList 必须单段。盘中用 [(PosiStartDate, rate)] 单段,不做 BuildSegmentRates 多段; - /// rate 入参须已是生效固定利率(GetInterests:746 GetFixedRate)。若保证金利率表被改成多段会漏分段。 + /// 前提(由前端保证金表单 + SwapTradeService 构造保证): + /// 1. InterestType=单利。本方法恒走 SimpleInterestAccrual 单利,不查 InterestType; + /// 若库内 InterestMode=5/6 且 InterestType=复利(脏数据),会与旧 CalcEodInterest 复利分支不一致。 + /// 2. 保证金=固定利率——这是业务定义,不是本方法的限制。前端无分段利率入口、SwapTradeService + /// 构造单段 SwapIntervalList,故 rate 入参即全程固定利率(GetFixedRate 对单段表返回 InterestRateDefault)。 + /// 盘中 segmentRates=[(PosiStartDate, rate)] 单段是对固定利率的正确建模。SwapIntervalList 多段是融资腿 + /// FR007 的概念,与保证金无关;本方法只消费 rate(GetFixedRate 已处理分段取值),不直接读 SwapIntervalList。 /// 契约与副作用: /// 3. position.InterestDirection 须已由调用方翻转(GetInterests:742 FlipDirection);本方法不翻转。 /// 4. preEod 在 id==0 时被就地修改(设 TdInterestPrincipal/PosiNotionalValue/FloatRate),与旧 CalcEodInterest 一致。