fix(swap): 修正日终保证金本金计算逻辑

- 移除保证金本金的1/10缩放处理,改为直接使用实际本金数值
- 修正了保证金本金计算中的除以10逻辑,确保显示正确的本金金额
- 保持利息计算使用原始本金累积值,避免破坏保证金利息金额准确性
- 更新注释说明,明确当前风险页按日终保证金
This commit is contained in:
张名锐
2026-07-23 17:49:02 +08:00
parent 7475bddc44
commit c4379d4b90
@@ -2327,24 +2327,23 @@ namespace YLErp.Modules.SwapModule
item.PeriodPaymentValuation = item.FloatingUnrealizedPnl + item.position.InterestPnL;
}
// eod_swap 的保证金本金来自 trade_span;缺少 span 数据时会被保存为 0。
// 本风险页改按日终保证金腿展示,且该页面保证金本金采用原始本金的 1/10 口径
// 利息仍使用原始本金累积值,不能同步缩放,否则会破坏保证金利息金额。
// 本风险页改按日终保证金腿的实际本金展示。
item.position.InitMarginGain = marginLegs
.Where(x => x.InterestMode == (int)InterestModeEnum.
&& x.InterestDirection == (int)SwapDirectionEnum.)
.Sum(x => Math.Abs(x.InterestPrincipalFix)) / 10m;
.Sum(x => Math.Abs(x.InterestPrincipalFix));
item.position.InitMarginLoss = marginLegs
.Where(x => x.InterestMode == (int)InterestModeEnum.
&& x.InterestDirection == (int)SwapDirectionEnum.)
.Sum(x => Math.Abs(x.InterestPrincipalFix)) / 10m;
.Sum(x => Math.Abs(x.InterestPrincipalFix));
item.position.PostionMarginGain = marginLegs
.Where(x => x.InterestMode == (int)InterestModeEnum.
&& x.InterestDirection == (int)SwapDirectionEnum.)
.Sum(x => Math.Abs(x.InterestPrincipalFix)) / 10m;
.Sum(x => Math.Abs(x.InterestPrincipalFix));
item.position.PostionMarginLoss = marginLegs
.Where(x => x.InterestMode == (int)InterestModeEnum.
&& x.InterestDirection == (int)SwapDirectionEnum.)
.Sum(x => Math.Abs(x.InterestPrincipalFix)) / 10m;
.Sum(x => Math.Abs(x.InterestPrincipalFix));
// 保证金本金方向与我方的利息现金流方向相反:原始“收取”保证金
// 表示我方占用客户资金,应向客户支付利息;支付金额按负数展示。