refactor(accrual): 抽取BuildSegmentRates共享分段取率+清理needPrice死参数
- 抽取 BuildSegmentRates:统一单利/复利分段取率循环,参数化 fetchAfterDate (单利传 ValueDate 仅取新段,复利传 null 全程取) - 修复 BuildSegmentRates static→instance:访问实例属性 IndexFixer - 清理 CalcDaily 层 needPrice 死参数:4个 CalcDaily* 方法签名移除 needPrice;上层 CalcSwapInterests/GetInterests 保留 (virtual seam/位置参数兼容) - 修复 6 处调用点 needPrice 参数传递 - 新增影子测试:单利+FR007浮动+部分平仓+历史归档,验证 segmentRates 一致 - 新增 TdCarryInCharacterizationTest:钉死部分平仓 TdInterestAmount carry-in 行为 测试: 511通过 / 7预存在失败(数据依赖) / 9跳过
This commit is contained in:
@@ -74,7 +74,7 @@ namespace UnitTestProject.Modules.SwapModule.Accrual
|
||||
decimal oldI = 0, oldTd = 0;
|
||||
var svc = new StubSvc();
|
||||
svc.CalcDailyCompoundInterest(EndDate, position, Notional, flowEvent,
|
||||
AnnualDays, false, 0m, 1m, true, false,
|
||||
AnnualDays, 0m, 1m, true, false,
|
||||
ref oldI, ref oldTd);
|
||||
|
||||
// 新方法:固定利率全段相同,分段点 = PosiStartDate + k×7
|
||||
@@ -122,7 +122,7 @@ namespace UnitTestProject.Modules.SwapModule.Accrual
|
||||
decimal oldI = 0, oldTd = 0;
|
||||
var svc = new StubSvc();
|
||||
svc.CalcDailyCompoundInterest(EndDate, position, Notional * closePct, flowEvent,
|
||||
AnnualDays, false, 0m, closePct, true, false,
|
||||
AnnualDays, 0m, closePct, true, false,
|
||||
ref oldI, ref oldTd, consumedInterest: consumed, resetCarryInterest: carry);
|
||||
|
||||
// 新方法
|
||||
@@ -166,7 +166,7 @@ namespace UnitTestProject.Modules.SwapModule.Accrual
|
||||
decimal oldI = 0, oldTd = 0;
|
||||
var svc = new StubSvc();
|
||||
svc.CalcDailyCompoundInterest(EndDate, position, Notional, flowEvent,
|
||||
AnnualDays, false, 0m, 1m, true, true,
|
||||
AnnualDays, 0m, 1m, true, true,
|
||||
ref oldI, ref oldTd);
|
||||
|
||||
// 新方法
|
||||
|
||||
Reference in New Issue
Block a user