#EQD-5857 资金记录-预付金返息和利息金额不正确

This commit is contained in:
吴方海
2026-05-11 17:57:08 +08:00
parent 8852d4d51a
commit bdaab1dee9
+16 -7
View File
@@ -402,6 +402,7 @@ namespace YLErp.Modules.SwapModule
// 根据场景计算利息
if (settment)
{
calcLast = calcLast = td.trade_extend.ExtendObj.InterestCalcMode.EndsWith("1");//算尾
// 收盘归档场景,使用 CalcEodInterest
interests.Add(CalcEodInterest(td, valueDate, positionClone, rate, floatRate, closePrincipal, posiPrincipal, annualDays, calcFirst, calcLast, preEodPosition, eventType, add));
}
@@ -496,7 +497,6 @@ namespace YLErp.Modules.SwapModule
bool calcToday = true;
if (calcFirst == false && valueDate == td.StartDate.Value) calcToday = false; // 首日不算头
if (calcLast == false && valueDate == td.ExerciseDate.Value) calcToday = false; // 到期日不算尾
// 初始化EOD持仓信息
if (preEod.id == 0)
{
@@ -530,17 +530,26 @@ namespace YLErp.Modules.SwapModule
decimal tdInterestAmount = 0;
if (calcToday)
{
if (position.InterestType == (int)InterestTypeEnum.)
// 收盘自动互换场景,如果不算尾,当天是不产生利息的
if (calcLast == false && eventType == (int)SwapEventTypeEnum.)
{
// 复利计算
CalcDailyCompoundInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount);
interestAmount= preEod.InterestProfitSum;
tdInterestAmount = 0;
}
else
{
// 单利计算
CalcDailySimpleInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount);
if (position.InterestType == (int)InterestTypeEnum.)
{
// 复利计算
CalcDailyCompoundInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount);
}
else
{
// 单利计算
CalcDailySimpleInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount);
}
}
}
// 四舍五入并赋值
interest.InterestAmount = Math.Round(interestAmount, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);