Commit Graph
2 Commits
Author SHA1 Message Date
hjhan b7469be104 refactor(margin): 保证金去除'计息基数'错误概念, 改用余额建模
保证金就是保证金——有余额、有利率、有利息, 不存在'计息基数/Notional'概念。
现有代码把保证金塞进 InterestPrincipalFix 当计息腿处理是错误建模。

修正:
- 删除 MarginLeg.cs(CalcBalance/accrualFactor 是融资腿的概念, 不该用在保证金)
- 新增 MarginAccount.cs: 管理余额变动(Deposit追加/Withdraw释放), 不含计息
- MarginBalance: 注释去掉'计息基数', 改为'保证金余额'
- IMarginResolver.Resolve: 去掉 accrualFactor 参数(融资腿比例, 非保证金概念)
- CashMargin/CreditMargin/GuaranteeMargin: 同步去掉 accrualFactor
- 枚举注释: '计息余额' → '余额'

保证金利息由 SwapInterest 纯函数按 余额×利率×天数/年化 计算,
MarginAccount 只提供余额, 不掺计息逻辑。

验证: sln编译0错误, 全量486测试7失败(基线一致,零回归)。
2026-08-11 10:06:27 +08:00
hjhan 55284fb76b refactor(margin): 抽出独立 Margin 限界上下文,移除 PrepayLeg 错误继承
- 新建 YLErp.Modules.SwapModule.Margin:MarginBalance / MarginLeg / IMarginResolver(Cash/Credit/Guarantee)

- MarginLeg 不继承 IInterestLegStrategy,与利息腿完全解耦(保证金是客户存款/担保,非互换腿)

- 删除 PrepayLeg,工厂不再注册 mode 5/6 预付金

- 预付金用例迁入 MarginLegTest,旧 InterestLegStrategyTest 改为断言预付金已非利息腿
2026-08-10 22:09:09 +08:00