平仓,如果平仓名义本金>持仓名义本金 =持仓名义本金

This commit is contained in:
吴方海
2025-06-13 13:26:56 +08:00
parent dfbeb20458
commit f7e6f7f40e
@@ -850,6 +850,7 @@ namespace YLErp.Modules.SwapModule
unwindData.CloseMethod = unwindQty == unwindData.PositionQty ? (int)CloseMethodEnum. : (int)CloseMethodEnum.;
unwindData.ClosePercent = unwindData.PositionQty == 0 ? 0 : unwindPercent;
unwindData.CloseNotionalValue = position == null ? 0 : unwindQty * position.PosiGrossPrice * position.ContractSize;
unwindData.CloseNotionalValue = unwindData.CloseNotionalValue > unwindData.PosiNotionalValue? unwindData.PosiNotionalValue: unwindData.CloseNotionalValue;
unwindData.CloseQty = unwindQty;
if (position != null)
{
@@ -881,7 +882,7 @@ namespace YLErp.Modules.SwapModule
floatEvent.TradingFee = closeFee;
floatEvent.MarkClosePnl = (unwindPrice - position.PosiGrossPrice) * unwindQty * floatRatio * longRatio;
floatEvent.MarkClosePnl = Math.Round(floatEvent.MarkClosePnl + ((floatEvent.TradingFeePending+ closeFee) * floatRatio * -1), ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
floatEvent.TradingAmount = unwindPrice * floatEvent.Quantity * floatEvent.ContractSize;
floatEvent.TradingAmount = unwindData.CloseNotionalValue;
floatEvent.OptLog = "流水自动";
floatEvent.ClientId = td.ClientId;
floatEvent.SetOpt(UserInfo);