fix(swap): 修复部分平仓计息计算中的尾差处理问题

- 修正了部分平仓后待实现利息收入的预期值从 0.006383561644 到 -0.010438356164
- 修正了预期待实现利息值从 0.820569301369 到 0.410474008219
- 在 SwapDealService 中添加了已完成平仓事件的查询逻辑,排除已平仓头寸的本金计算
- 重构了 SwapEodPositionService 中的待结算利息计算逻辑,区分自动互换和平仓场景
- 在测试类中添加了已完成流程事件的查找方法和相关测试数据
- 更新了测试用例以验证平仓事件对利息计算的影响
This commit is contained in:
张名锐
2026-08-06 21:35:13 +08:00
parent e3c473bafd
commit 01d7f0c55e
4 changed files with 34 additions and 10 deletions
@@ -1412,12 +1412,9 @@ namespace YLErp.Modules.SwapModule
}
else
{
var useAccrualBalance = !autoSwap
&& (position.InterestMode == (int)InterestModeEnum.
|| position.InterestMode == (int)InterestModeEnum.);
var pendingInterestBeforeSettlement = useAccrualBalance
? lastInterestIncomeSum + newEodPayPosition.TdInterestIncome
: interestAmountBeforeSettlement;
var pendingInterestBeforeSettlement = autoSwap
? interestAmountBeforeSettlement
: lastInterestIncomeSum + newEodPayPosition.TdInterestIncome;
newEodPayPosition.InterestIncomeSum = RoundEodInterest(
pendingInterestBeforeSettlement - newEodPayPosition.TdCloseInterest);
newEodPayPosition.InterestFeeSum = eodPayPosition.InterestFeeSum + newEodPayPosition.TdInterestFee - newEodPayPosition.TdCloseInterestFee;