From 7f6bdde5211c4eab6ce2f2b4ff161e8f52f4e7af Mon Sep 17 00:00:00 2001 From: tengyufan <1532636164@qq.com> Date: Thu, 25 Jun 2026 20:00:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DV01=E6=B1=87=E6=80=BB=E5=8F=8A=E5=90=88?= =?UTF-8?q?=E8=AE=A1=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs - 日终版本(QueryEodGlobalFromCalc)恢复互换行DV限额取值 2. YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs - SaveEodSwap / UpdateEodSwap 补充 eod_Swap.dv01 汇总 - SearchEodSwapList 新增DV合计,返回至前端footer 3. YLErpWeb/wwwroot/Scripts/app/swaptrade/EodPositionRisks.js - 框架合约tab启用footerrow,展示DV合计 - 框架合约DV列formatter改为4位小数 --- YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs | 8 ++++---- .../Modules/SwapModule/SwapEodPositionService.cs | 5 +++++ .../Scripts/app/swaptrade/EodPositionRisks.js | 12 ++++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs b/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs index be5b8e2e..906f710c 100644 --- a/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs +++ b/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs @@ -1047,10 +1047,10 @@ namespace YLErp.Modules.RiskModule }; setValue(swap, swapSetting); swap.DV = eodSwapDV; - //swap.Quota_DV_Upper = tradeDvSetting?.QuotaUpperLimit ?? double.NaN; - //swap.Quota_DV_Lower = tradeDvSetting?.QuotaLowerLimit ?? double.NaN; - //swap.Quota_DV_wUpper = tradeDvSetting?.WarningUpperLimit ?? double.NaN; - //swap.Quota_DV_wLower = tradeDvSetting?.WarningLowerLimit ?? double.NaN; + swap.Quota_DV_Upper = tradeDvSetting?.QuotaUpperLimit ?? double.NaN; + swap.Quota_DV_Lower = tradeDvSetting?.QuotaLowerLimit ?? double.NaN; + swap.Quota_DV_wUpper = tradeDvSetting?.WarningUpperLimit ?? double.NaN; + swap.Quota_DV_wLower = tradeDvSetting?.WarningLowerLimit ?? double.NaN; var underly = GetEodTradePositionPnl(req.ValueDate); var unTrade = new QuotaMonitor_Global() { diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index 98691d38..c16fe670 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -1747,6 +1747,7 @@ namespace YLErp.Modules.SwapModule eod_Swap.MarketValueLong = positions.Where(x => x.PositionType == (int)PositionTypeFlag.Long).Sum(s => s.UnderlyingMarketValue); eod_Swap.MarketValueShort = positions.Where(x => x.PositionType == (int)PositionTypeFlag.Short).Sum(s => s.UnderlyingMarketValue); eod_Swap.FloatingPnL = positions.Sum(s => s.PosiProfitSum); + eod_Swap.dv01 = positions.Sum(s => s.dv01 ?? 0); decimal interestPnL = 0; interestPositions.ForEach(x => { @@ -1811,6 +1812,7 @@ namespace YLErp.Modules.SwapModule eod_Swap.MarketValueLong = positions.Where(x => x.PositionType == (int)PositionTypeFlag.Long).Sum(s => s.UnderlyingMarketValue); eod_Swap.MarketValueShort = positions.Where(x => x.PositionType == (int)PositionTypeFlag.Short).Sum(s => s.UnderlyingMarketValue); eod_Swap.FloatingPnL = positions.Sum(s => s.PosiProfitSum); + eod_Swap.dv01 = positions.Sum(s => s.dv01 ?? 0); interestPositions.ForEach(x => { decimal ratio = x.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1;//收取为正,支付为负 @@ -1999,6 +2001,9 @@ namespace YLErp.Modules.SwapModule var client = DataCacheProvider.GetClientDataSource().GetData(item.ClientId); item.SwapTradeTypeStr = client?.SwapTradeTypeStr; } + + var dv01 = query.Sum(O => O.position.dv01??0); + retListResult.Sum = new {DV = dv01 }; return retListResult; } diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/EodPositionRisks.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/EodPositionRisks.js index 9770c225..5abf3e14 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/EodPositionRisks.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/EodPositionRisks.js @@ -38,7 +38,7 @@ $(function () { pagerpos: 'left', rowNum: 25, rowList: [25, 50, 100, 200, 10000], - footerrow: false, + footerrow: page.tabIndex == 2, loadComplete: gridComplete, onPaging: onJqgridPaging, grouping: true @@ -616,7 +616,12 @@ function colModelGridEodSwap() { index: 'position.dv01', width: 120, align: 'center', - formatter: StockEqvNotionalFormat, + formatter: function (cellvalue, options, rowObject) { + if (Number.isNaN(cellvalue)) return "0"; + var abs = Math.abs(Number(cellvalue)); + if (abs < 0.0001) return "0"; + return cellvalue.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 4 }); + }, }, { name: 'SwapTradeTypeStr', label: '互换类型', @@ -633,6 +638,9 @@ function colModelGridEodSwap() { function gridComplete() { var jgrid = $(this); + if (arguments[0].Sum) { + jgrid.footerData("set", { 'position.dv01': arguments[0].Sum["DV"] }); + } main.setcolumnChooser(jgrid, page.configcolumn_data); $(window).resize(); }