feat(swap): 实现预付金模式下部分平仓的待实现收益计算

- 添加DI_MANUAL_PREPAY_PARTIAL_CLOSE_UsesHistoryPlusRemainingDailyInterest测试方法
- 验证预付金部分平仓待实现收益为历史待实现加平仓后当日新增减平仓实现
- 修改ExecuteSaveAutoEodWithCloseInterestPosition方法中待实现收益计算逻辑
- 新增useAccrualBalance标识判断是否使用应计余额计算方式
- 对于预付金模式使用历史待实现收益加当日新增减平仓实现的方式计算
This commit is contained in:
张名锐
2026-08-06 18:39:20 +08:00
parent 40b4e2e697
commit c425594833
2 changed files with 32 additions and 1 deletions
@@ -782,6 +782,31 @@ namespace YLErp.Modules.SwapModule
"The previous EOD identity must not be reset to a new position");
}
[TestMethod]
public void DI_MANUAL_PREPAY_PARTIAL_CLOSE_UsesHistoryPlusRemainingDailyInterest()
{
var service = new StubEodPositionService();
var td = CreateTrade();
var position = CreateInterestPosition();
position.InterestMode = (int)InterestModeEnum.;
position.InterestPrincipalFix = Principal;
var previousEod = CreatePreEod(StartDate.AddDays(2), 100m);
previousEod.InterestMode = position.InterestMode;
previousEod.TdInterestPrincipal = Principal;
var closeFlow = CreateSwapFlowEvent(StartDate.AddDays(3), 50m);
closeFlow.EventType = (int)SwapFlowEventTypeEnum.;
closeFlow.InterestPrincipal = 500m;
var result = service.ExecuteSaveAutoEodWithCloseInterestPosition(
previousEod, position, td, StartDate.AddDays(3), null,
500m, 0m, new List<swap_flow_event> { closeFlow }, 500m, false);
var expected = previousEod.InterestIncomeSum
+ result.TdInterestIncome - result.TdCloseInterest;
AssertDecimal(expected, result.InterestIncomeSum,
"预付金部分平仓待实现收益应为历史待实现+平仓后当日新增-平仓实现");
}
[TestMethod]
public void DI_AUTO_SETTLEMENT_005_AutoSettlementKeepsRemainingPrincipal()
{