fix(swap): 修复部分平仓后算尾利息计算问题(算头算尾T+0合约单利)
- 将测试方法改为数据驱动测试以覆盖不同利息模式 - 在测试中添加对不同利息模式的验证逻辑 - 修复平仓后EOD本金只携带剩余持仓的计算逻辑 - 添加对算尾部分平仓后EOD本金的断言验证 - 优化单利算尾当日按平仓前全额计提的处理逻辑
This commit is contained in:
@@ -1453,6 +1453,16 @@ namespace YLErp.Modules.SwapModule
|
||||
newEodPayPosition.TdInterestIncome /= tradeExtend.AnnualDays;
|
||||
}
|
||||
}
|
||||
if (!autoSwap
|
||||
&& closePercent > 0m && closePercent < 1m
|
||||
&& posiNotionalValue > 0m
|
||||
&& position.InterestType == (int)InterestTypeEnum.单利
|
||||
&& (position.InterestMode == (int)InterestModeEnum.合约名义本金规模
|
||||
|| position.InterestMode == (int)InterestModeEnum.标的期初全价))
|
||||
{
|
||||
// 单利算尾当日仍按平仓前全额计提,跨日 EOD 本金只携带剩余持仓。
|
||||
newEodPayPosition.TdInterestPrincipal = posiNotionalValue;
|
||||
}
|
||||
Log.Info($"InterestIncomeSum is {lastInterestIncomeSum},TdInterestIncome is {newEodPayPosition.TdInterestIncome}" +
|
||||
$",TdCloseInterest is {newEodPayPosition.TdCloseInterest}");
|
||||
Log.Info($"InterestFeeSum is {eodPayPosition.InterestFeeSum},TdInterestFee is {newEodPayPosition.TdInterestFee}" +
|
||||
|
||||
Reference in New Issue
Block a user