hjhan
79e9304114
refactor(interest): 新增利息腿策略接口 + 3个活跃mode实现
为拆三类腿做准备,按 Strategy 模式封装 CalcNotionalByMode 的 switch。
本次零生产代码改动,全部为新增小文件,每个类单一职责<50行。
新增(策略接口+值对象):
- InterestLegs/IInterestLegStrategy.cs
NotionalResult 值对象(closePrincipal/posiPrincipal/closePercent)
+ IInterestLegStrategy 接口(每个mode一个实现)
新增(3个活跃利息腿mode):
- InterestLegs/FixedNotionalLeg.cs mode 1 固定值
计息基数恒=InterestPrincipalFix, 不随平仓比例变化(合同写死的固定值)
- InterestLegs/ContractNotionalLeg.cs mode 2 合约名义本金规模
平仓本金=posiNotional×closePercent, 按比例线性缩放
- InterestLegs/UnderlyingFullPriceLeg.cs mode 9 标的期初全价
主路径公式同mode2, 差异在衡泰路径grossPrice折算+EOD复利反推
确认现状:
- 界面实际只有3个活跃利息腿mode(1/2/9), TradeView.cshtml:330-349
- mode 3(持仓名义本金)/4(持仓市值) 零引用=死代码, 本次不实现
- mode 7/8(多空存续) 界面已注释掉, 本次不实现
- mode 5/6(预付金) 属保证金维度, 后续单独做PrepayLeg
新增测试(8个,全过):
- InterestLegStrategyTest.cs 覆盖各mode的部分平仓/全平/零平仓场景
验证策略行为与现有CalcNotionalByMode switch完全一致
2026-08-10 18:32:17 +08:00
..
2026-08-10 18:32:17 +08:00
2026-07-17 10:59:18 +08:00
2026-08-10 11:08:46 +08:00
2026-07-23 11:16:11 +08:00
2026-07-27 13:18:32 +08:00
2026-07-23 11:16:11 +08:00
2026-08-07 23:00:28 +08:00
2026-07-23 11:16:11 +08:00
2026-07-23 11:16:11 +08:00
2026-08-09 22:07:19 +08:00
2026-08-07 17:44:04 +08:00
2026-08-09 22:28:40 +08:00
2026-08-09 22:28:40 +08:00
2026-07-23 11:16:11 +08:00
2026-08-09 22:28:40 +08:00
2026-07-17 10:59:18 +08:00
2026-07-20 18:41:16 +08:00
2026-08-07 19:00:31 +08:00
2026-07-02 09:37:18 +08:00
2026-07-21 15:28:15 +08:00
2026-07-21 15:28:15 +08:00
2026-07-17 08:23:50 +08:00
2026-08-05 18:26:15 +08:00
2026-07-03 09:38:05 +08:00
2026-07-03 09:26:13 +08:00
2026-07-02 09:20:41 +08:00
2026-07-23 11:16:11 +08:00
2026-08-10 13:17:12 +08:00
2026-08-08 15:46:54 +08:00
2026-07-03 09:38:05 +08:00
2026-07-01 17:07:55 +08:00
2026-08-09 16:06:09 +08:00
2026-06-26 09:13:37 +08:00
2026-02-13 18:12:00 +08:00
2026-07-17 08:40:19 +08:00
2026-07-21 15:28:13 +08:00
2026-07-21 15:28:14 +08:00
2026-08-06 14:44:30 +08:00
2026-08-08 09:31:43 +08:00
2026-08-09 11:22:42 +08:00
2026-07-01 13:38:24 +08:00
2026-08-09 22:28:40 +08:00
2026-07-21 15:28:17 +08:00
2026-07-21 15:28:13 +08:00
2026-08-08 09:31:43 +08:00
2026-07-16 13:00:21 +08:00
2026-07-16 11:09:47 +08:00
2026-08-10 18:01:37 +08:00
2026-08-07 13:46:24 +08:00
2026-07-21 15:28:13 +08:00
2026-07-03 18:12:52 +08:00
2026-08-10 11:08:46 +08:00
2026-07-03 09:26:13 +08:00
2026-07-03 09:20:59 +08:00