diff --git a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs
index f2f1c827..7523323b 100644
--- a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs
+++ b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs
@@ -107,13 +107,13 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
//row.MarginInterestAmount = MarginInterestAmount.ToString("0.00");
var FloatRate = PosiNotionalValue == 0 ? 0 : InterestAmount / PosiNotionalValue;
row.FloatRate = FloatRate.ToString("0.0000%");
- var PosiPnl = -(flowEventGroup.MarkClosePnl - tradingFee - flowEventGroup.DividendIn);
+ var PosiPnl = -flowEventGroup.MarkClosePnl;
row.PosiPnl = PosiPnl.ToString("0.00");
- var markClosePnl = (-flowEventGroup.MarkClosePnl);
+ var markClosePnl = -flowEventGroup.FloatPnlSum;
row.MarkClosePnl = markClosePnl.ToString("0.00");
row.DividendIn = (-flowEventGroup.DividendIn).ToString("0.00");
var marginBackAmount = unwindFlowEvents.Where(x => ConsTrade.InterestMarginModels.Contains(x.InterestMode)).Sum(s => s.InterestPrincipal);
- var NetSettleAmout = unwindFlowEvents.Sum(x => x.InterestClosePnL) * -1 + flowEventGroup.MarkClosePnl * -1 + marginBackAmount;
+ var NetSettleAmout = unwindFlowEvents.Sum(x => x.InterestClosePnL) * -1 + flowEventGroup.FloatPnlSum * -1 + marginBackAmount;
row.NetSettleAmout = NetSettleAmout.ToString("0.00");
table.Add(row);
}
diff --git a/YLErpDAL/BLL/EodSettlement/RealTimeClientBanlanceService.cs b/YLErpDAL/BLL/EodSettlement/RealTimeClientBanlanceService.cs
index e60beb81..dcead87e 100644
--- a/YLErpDAL/BLL/EodSettlement/RealTimeClientBanlanceService.cs
+++ b/YLErpDAL/BLL/EodSettlement/RealTimeClientBanlanceService.cs
@@ -1334,13 +1334,13 @@ namespace YLErp.BLL.Eod
}
unwindPercent = posiQty == 0 ? 0 : unwindQty / posiQty;
}
- var tdRealizedPnL = flowEvents.Where(x => x.EventDate > lastSettletDate).ToList().Sum(s => s.InterestClosePnL + s.MarkClosePnl);
+ var tdRealizedPnL = flowEvents.Where(x => x.EventDate > lastSettletDate).ToList().Sum(s => s.InterestClosePnL + s.FloatPnlSum);
var tdRealizedInterestPnL = flowEvents.Where(x => x.EventDate > lastSettletDate).ToList().Sum(s => s.InterestClosePnL);
var tradeFee= flowEvents.Where(x => x.EventDate > lastSettletDate).ToList().Sum(s => s.TradingFee+s.TradingFeePending);
balance.InterestPnl += Convert.ToDouble(tdRealizedInterestPnL)*-1;
balance.TradeFee += Convert.ToDouble(tradeFee) *-1;
var currentEvents = flowEvents.Where(x => x.EventDate == startDate).ToList();
- var currentRealizedPnl = currentEvents.Sum(s => s.InterestClosePnL + s.MarkClosePnl);
+ var currentRealizedPnl = currentEvents.Sum(s => s.InterestClosePnL + s.FloatPnlSum);
//潜在行权收益等于实值额
balance.PotentialSurpluses += -Convert.ToDouble(pnl);
//持仓市值
diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs
index beca764f..18ade2a8 100644
--- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs
@@ -1099,8 +1099,8 @@ namespace YLErp.Modules.SwapModule
floatEvent.TradingFeePending = Math.Round(floatEvent.TradingFeePending, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
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);
+ //MarkClosePnl 纯盯市不要计算交易费用和分红
+ floatEvent.MarkClosePnl = Math.Round(floatEvent.MarkClosePnl, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
floatEvent.TradingAmount = unwindPrice * floatEvent.Quantity * floatEvent.ContractSize;
floatEvent.TradingAmount = Math.Round(floatEvent.TradingAmount, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
floatEvent.OptLog = "流水自动";
@@ -1347,7 +1347,7 @@ namespace YLErp.Modules.SwapModule
var floatPosition = unwindData.FlowEvents.FirstOrDefault(x => !string.IsNullOrEmpty(x.UnderlyingCode));
var interestList = unwindData.FlowEvents.Where(x => string.IsNullOrEmpty(x.UnderlyingCode));
decimal floatRatio = floatPosition.PayDirection == 1 ? 1m : -1m;
- var pnl = floatPosition.MarkClosePnl;
+ var pnl = floatPosition.FloatPnlSum;
unwindData.SwapCloseAmount = pnl;
unwindData.SwapRealizedPnL = pnl;
unwindData.SwapMarginRebatePnl = 0;
diff --git a/YLErpDAL/Modules/SwapModule/SwapEndConfirmService.cs b/YLErpDAL/Modules/SwapModule/SwapEndConfirmService.cs
index 8ddb7786..39595512 100644
--- a/YLErpDAL/Modules/SwapModule/SwapEndConfirmService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapEndConfirmService.cs
@@ -93,7 +93,7 @@ namespace YLErp.Modules.SwapModule
if (x.trade.StructureType == "多空组合")
{
UnwindData unwindData = new UnwindData();
- unwindData.SwapCloseAmount = x.swap_flow_event.MarkClosePnl;
+ unwindData.SwapCloseAmount = x.swap_flow_event.FloatPnlSum;
x.swap_event.unwindData = unwindData;
}
}
diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs
index 8e1598d7..6cd59d66 100644
--- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs
@@ -1507,12 +1507,9 @@ namespace YLErp.Modules.SwapModule
{
curretEod.PosiDividendSum = 0;
}
- if (curretEod.PosiDividendSum == 0)//这里处理一下已实现盈亏和互换价值,其他在处理分红的时候会处理
- {
- curretEod.RealizedPnl += curretEod.TdCloseDividend;
- curretEod.SwapPositionValue -= curretEod.TdCloseDividend;
+ curretEod.RealizedPnl += curretEod.TdCloseDividend;
+ curretEod.SwapPositionValue -= curretEod.TdCloseDividend;
- }
curretEod.PosiProfitSum = curretEod.PosiMtmPnL + curretEod.PosiDividendSum + curretEod.PosiFeePending;
if (curretEod.PosiStatus == 1)
{
diff --git a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs
index 3bad869c..b6d9fec1 100644
--- a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs
@@ -525,8 +525,8 @@ namespace YLErp.Modules.SwapModule
{
item.TradeFee = item.FlowEvent.TradingFee;
item.TradingFee = item.FlowEvent.TradingFeePending;
- item.PosiPnl= item.FlowEvent.MarkClosePnl- item.TradeFee-item.FlowEvent.DividendIn - item.TradingFee;
- item.NetSettmentAmount = item.FlowEvent.MarkClosePnl + item.FlowEvent.InterestClosePnL;
+ item.PosiPnl= item.FlowEvent.MarkClosePnl;//MarkClosePnl 纯盯市不计算交易费用和分红
+ item.NetSettmentAmount = item.FlowEvent.FloatPnlSum + item.FlowEvent.InterestClosePnL;
item.Days = (item.FlowEvent.UnwindDate - item.StartDate).Value.Days;
}
diff --git a/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml b/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml
index ca19bcc7..8084253a 100644
--- a/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml
+++ b/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml
@@ -166,7 +166,7 @@
我方{{floatPosition.PayDirection==1?"支付":"收取"}}交易费用
|
- {{floatPosition.MarkClosePnl}} |
+ {{floatPosition.FloatPnlSum}} |
diff --git a/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml b/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml
index 1bb5484d..029907c6 100644
--- a/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml
+++ b/YLErpWeb/Views/SwapTrade2/SwapUnwind.cshtml
@@ -213,7 +213,7 @@
{{floatPosition.DividendIn}} |
- {{floatPosition.MarkClosePnl}} |
+ {{floatPosition.FloatPnlSum}} |
diff --git a/YLErpWeb/Views/SwapTrade2/TradeView.cshtml b/YLErpWeb/Views/SwapTrade2/TradeView.cshtml
index a1f946dc..979dfd6c 100644
--- a/YLErpWeb/Views/SwapTrade2/TradeView.cshtml
+++ b/YLErpWeb/Views/SwapTrade2/TradeView.cshtml
@@ -808,7 +808,7 @@
@(closeFloat.TradingFee.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
@(closeFloat.TradingFeePending.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
@(closeFloat.DividendIn.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
- @(closeFloat.MarkClosePnl.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
+ @(closeFloat.FloatPnlSum.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
@@ -1000,7 +1000,7 @@
@((closeFloat.PositionQty??0).OtcFormat(OtcFormatFlag.StockEqvNotional)) |
@(closeFloat.TradingFee.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
@(closeFloat.DividendIn.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
- @(closeFloat.MarkClosePnl.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
+ @(closeFloat.FloatPnlSum.OtcFormat(OtcFormatFlag.StockEqvNotional)) |
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js
index 5ca6dd7e..5119c22d 100644
--- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js
+++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js
@@ -131,8 +131,8 @@ const vue = new Vue({
let DividendIn = thisObj.floatPosition.DividendIn == "" ? 0 : parseFloat(thisObj.floatPosition.DividendIn ?? 0);
let scale = thisObj.getPriceScale();
thisObj.floatPosition.MarkClosePnl = thisObj.deal.CloseNotionalValue * (thisObj.floatPosition.TradingAmountAvg * scale - thisObj.initPosiNetPrice) * floatRatio;
- thisObj.floatPosition.MarkClosePnl = thisObj.floatPosition.MarkClosePnl + TradingFee + TradingFeePending;//当日盯市不要计算分红
- thisObj.floatPosition.MarkClosePnl = otcformat.trading.StockEqvNotional(thisObj.floatPosition.MarkClosePnl);
+ thisObj.floatPosition.MarkClosePnl = otcformat.trading.StockEqvNotional(thisObj.floatPosition.MarkClosePnl);//MarkClosePnl 纯盯市不要计算交易费用和分红
+ thisObj.floatPosition.FloatPnlSum = parseFloat(thisObj.floatPosition.MarkClosePnl) + TradingFee + TradingFeePending + DividendIn;
thisObj.calcCloseAmount();
},
//calcClosePnL() {//计算浮动端平仓盈亏
@@ -195,7 +195,7 @@ const vue = new Vue({
var postData = { startDate: thisObj.TradeStartDate, endDate: thisObj.deal.UnwindDate, underlyingCode: thisObj.floatPosition.UnderlyingCode, tradeId: thisObj.deal.SwapTradeId, unwindDate: thisObj.deal.UnwindDate }
main.post("/BondPayment/GetBondPayMentInterest", postData, { async: false }).done(function (resp) {
let totalDividend = parseFloat(thisObj.deal.PositionQty) * resp.obj.totalInterest * ratio * floatRatio;
- let consumedDividend = Math.abs(parseFloat(resp.obj.consumedDividend ?? 0));
+ let consumedDividend = Math.abs(parseFloat(resp.obj.consumedDividend ?? 0)) * ratio * floatRatio;
// 互换是全量消费,consumedDividend>0 表示分红已被当天互换消费,归0
thisObj.floatPosition.DividendIn = Math.abs(consumedDividend) > 0 ? parseFloat((totalDividend - consumedDividend).toFixed(2)) : parseFloat(totalDividend.toFixed(2));
thisObj.floatPosition.DividendPending = 0;
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js
index ada0a2f0..ea9998ea 100644
--- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js
+++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js
@@ -201,9 +201,9 @@ const vue = new Vue({
let TradingFeePending = thisObj.floatPosition.TradingFeePending == "" ? 0 : parseFloat(thisObj.floatPosition.TradingFeePending);
let scale = thisObj.getPriceScale();
thisObj.floatPosition.MarkClosePnl = Math.round(thisObj.deal.CloseQty * (thisObj.floatPosition.TradingAmountAvg * scale - thisObj.initPosiNetPrice) * floatRatio * longRatio * 10000) / 10000;
- thisObj.floatPosition.MarkClosePnl = Number(thisObj.floatPosition.MarkClosePnl.toFixed(2));
- thisObj.floatPosition.MarkClosePnl = thisObj.floatPosition.MarkClosePnl + (TradingFee + TradingFeePending) * floatRatio * -1;//当日盯市不要计算分红
+ thisObj.floatPosition.MarkClosePnl = Number(thisObj.floatPosition.MarkClosePnl.toFixed(2));//MarkClosePnl 纯盯市不要计算交易费用和分红
thisObj.floatPosition.MarkClosePnl = otcformat.trading.StockEqvNotional(thisObj.floatPosition.MarkClosePnl);
+ thisObj.floatPosition.FloatPnlSum = parseFloat(thisObj.floatPosition.MarkClosePnl) + TradingFee + TradingFeePending + parseFloat(thisObj.floatPosition.DividendIn);
thisObj.calcCloseAmount();
},