From 633cd7d32d762f1df39be90ccc223621ff53641d Mon Sep 17 00:00:00 2001 From: yexuzhong <120511780@qq.com> Date: Fri, 31 Jul 2026 14:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=8C=87=E6=A0=87=E5=8F=AF?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CalcPriceShowConfigService.cs | 11 +++- .../Models/TradeValueResult.cs | 22 +++++++- .../EodModule/EodPositionRisksQueryService.cs | 4 +- .../EodModule/GLMSGreeksHandleService.cs | 15 +++++- .../Modules/PricingModule/PriceCalcService.cs | 8 ++- YLErpWeb/App_Data/FunctionRight.xml | 1 + YLErpWeb/Views/Pricing/_PricingItemTpl.cshtml | 51 ++++++++++++++++++- .../wwwroot/Scripts/app/pricing/structure.js | 11 +++- 8 files changed, 112 insertions(+), 11 deletions(-) diff --git a/YLErpDAL/Modules/CalcPriceShowConfigModule/CalcPriceShowConfigService.cs b/YLErpDAL/Modules/CalcPriceShowConfigModule/CalcPriceShowConfigService.cs index c81b4093..c021ef8a 100644 --- a/YLErpDAL/Modules/CalcPriceShowConfigModule/CalcPriceShowConfigService.cs +++ b/YLErpDAL/Modules/CalcPriceShowConfigModule/CalcPriceShowConfigService.cs @@ -1,4 +1,4 @@ -using MoreLinq; +using MoreLinq; using System; using System.Collections.Generic; using System.Linq; @@ -248,7 +248,14 @@ namespace YLErp.Modules.CalcPriceShowConfigModule new CalcQuotaDto{Name="Vegacash",Tip=""}, new CalcQuotaDto{Name="PV*",Tip="*号标记的字段是所有涉及到敲出的期权结构,若当天为该期权的观察日,当盘中实时价格越过敲出价时,该笔结构的估值只包含Payoff,不需要再包含时间价值,同时该笔交易的Delta手数和Gamma手数都变成0\r\n\r\n系统默认在盘中的时候期权价值=内在价值+时间价值"}, new CalcQuotaDto{Name="Delta*",Tip="*号标记的字段是所有涉及到敲出的期权结构,若当天为该期权的观察日,当盘中实时价格越过敲出价时,该笔结构的估值只包含Payoff,不需要再包含时间价值,同时该笔交易的Delta手数和Gamma手数都变成0\r\n\r\n系统默认在盘中的时候期权价值=内在价值+时间价值"}, - new CalcQuotaDto{Name="Gamma*",Tip="*号标记的字段是所有涉及到敲出的期权结构,若当天为该期权的观察日,当盘中实时价格越过敲出价时,该笔结构的估值只包含Payoff,不需要再包含时间价值,同时该笔交易的Delta手数和Gamma手数都变成0\r\n\r\n系统默认在盘中的时候期权价值=内在价值+时间价值"} + new CalcQuotaDto{Name="Gamma*",Tip="*号标记的字段是所有涉及到敲出的期权结构,若当天为该期权的观察日,当盘中实时价格越过敲出价时,该笔结构的估值只包含Payoff,不需要再包含时间价值,同时该笔交易的Delta手数和Gamma手数都变成0\r\n\r\n系统默认在盘中的时候期权价值=内在价值+时间价值"}, + new CalcQuotaDto{Name="Delta_r",Tip=""}, + new CalcQuotaDto{Name="Delta_r(1bp)",Tip=""}, + new CalcQuotaDto{Name="Dv01",Tip=""}, + new CalcQuotaDto{Name="Gamma_r",Tip=""}, + new CalcQuotaDto{Name="Gamma_r(1bp)",Tip=""}, + new CalcQuotaDto{Name="Vega_r",Tip=""}, + new CalcQuotaDto{Name="Vega_r(1bp)",Tip=""}, }; } diff --git a/YLErpDAL/Modules/CalculationModule/Models/TradeValueResult.cs b/YLErpDAL/Modules/CalculationModule/Models/TradeValueResult.cs index f28cd464..d7df7d83 100644 --- a/YLErpDAL/Modules/CalculationModule/Models/TradeValueResult.cs +++ b/YLErpDAL/Modules/CalculationModule/Models/TradeValueResult.cs @@ -1,4 +1,4 @@ -using Qdp.Pricing.Base.Interfaces; +using Qdp.Pricing.Base.Interfaces; namespace YLErp.Modules.CalculationModule { @@ -495,6 +495,26 @@ namespace YLErp.Modules.CalculationModule /// Theta(轧差) /// public double ThetaNet { get; set; } + + + + /// + /// Delta_R + /// + public double? Delta_r { get; set; } + + public double? Delta_r_1bp { get; set; } + + + public double? Dv01 { get; set; } + + public double? Gamma_r { get; set; } + + public double? Gamma_r_1bp { get; set; } + + public double? Vega_r { get; set; } + + public double? Vega_r_1bp { get; set; } } public class TradeValueResultExtend diff --git a/YLErpDAL/Modules/EodModule/EodPositionRisksQueryService.cs b/YLErpDAL/Modules/EodModule/EodPositionRisksQueryService.cs index 821f5ae2..e9a3286e 100644 --- a/YLErpDAL/Modules/EodModule/EodPositionRisksQueryService.cs +++ b/YLErpDAL/Modules/EodModule/EodPositionRisksQueryService.cs @@ -472,7 +472,7 @@ namespace YLErp.Modules.EodModule r.DeltaLots = (r.Delta ?? 0) / um.ContractSize; } r.Rho *= 100; - greeksHandleService.Handle(r); + greeksHandleService.Handle(r,um); if (r.trade == null) { r.TradeSinglePrice = r.etcTradePrice / r.TradeAmount; @@ -1206,7 +1206,7 @@ namespace YLErp.Modules.EodModule } r.Rho *= 100; - greeksHandleService.Handle(r); + greeksHandleService.Handle(r,um); r.CountRatio = um.CountRatio; r.TradeOriginalAmount = r.OriginalNotional / um.CountRatio; r.etcTradePrice = ConsTrade.TradeTypesForHedge.Contains(r.TradeType) diff --git a/YLErpDAL/Modules/EodModule/GLMSGreeksHandleService.cs b/YLErpDAL/Modules/EodModule/GLMSGreeksHandleService.cs index 4385923a..97020691 100644 --- a/YLErpDAL/Modules/EodModule/GLMSGreeksHandleService.cs +++ b/YLErpDAL/Modules/EodModule/GLMSGreeksHandleService.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using YLErp.Model; +using YLErp.Modules.CalculationModule; namespace YLErp.Modules.EodModule { @@ -19,10 +20,22 @@ namespace YLErp.Modules.EodModule } - public void Handle(EodPositionRisksDTO dto) + public void Handle(EodPositionRisksDTO dto,underlying_manager um) { //对Delta_r Delta_r_1bp Dv01 Gamma_r Gamma_r_1bp Vega_r Vega_r_1bp + if ("GB10".Equals(um.UnderlyingCode)) + { + dto.Delta_r = dto.Delta * -1; + } + + + } + + + public void Handle(trade td,TradeValueResult calRes) + { + calRes.Delta_r = calRes.Delta * -1; } } } diff --git a/YLErpDAL/Modules/PricingModule/PriceCalcService.cs b/YLErpDAL/Modules/PricingModule/PriceCalcService.cs index 4be94b0a..5e59a00c 100644 --- a/YLErpDAL/Modules/PricingModule/PriceCalcService.cs +++ b/YLErpDAL/Modules/PricingModule/PriceCalcService.cs @@ -1,4 +1,4 @@ -using Qdp.Pricing.Base.Implementations; +using Qdp.Pricing.Base.Implementations; using System.Text.RegularExpressions; using YLErp.BLL; using YLErp.BLL.Calculation.V2; @@ -11,6 +11,7 @@ using YLErp.Enums; using YLErp.Model; using YLErp.Modules.CalculationModule; using YLErp.Modules.DataProviderModule; +using YLErp.Modules.EodModule; using YLErp.Modules.PricingModule.Models; using YLErp.Modules.TradeModule; using YLErp.QdpModule; @@ -500,7 +501,7 @@ namespace YLErp.Modules.PricingModule } } } - + var greeksHandleService = new GLMSGreeksHandleService(); foreach (var item in tdList) { var td = item.tdConv; @@ -529,6 +530,9 @@ namespace YLErp.Modules.PricingModule } } + + greeksHandleService.Handle(td, calcResult); + results.Add(new CalcOptionPriceResult { BuySell = td.BuySell, diff --git a/YLErpWeb/App_Data/FunctionRight.xml b/YLErpWeb/App_Data/FunctionRight.xml index 03ee9a6a..eccba1c4 100644 --- a/YLErpWeb/App_Data/FunctionRight.xml +++ b/YLErpWeb/App_Data/FunctionRight.xml @@ -7,6 +7,7 @@ + diff --git a/YLErpWeb/Views/Pricing/_PricingItemTpl.cshtml b/YLErpWeb/Views/Pricing/_PricingItemTpl.cshtml index fd3809ad..6d565236 100644 --- a/YLErpWeb/Views/Pricing/_PricingItemTpl.cshtml +++ b/YLErpWeb/Views/Pricing/_PricingItemTpl.cshtml @@ -1,4 +1,4 @@ -@using YLErp.Modules.CalcPriceShowConfigModule +@using YLErp.Modules.CalcPriceShowConfigModule @*定价模板*@ @model PricingModel @{ @@ -1199,6 +1199,55 @@ {{calcResult.GammaContainsKnockOut}} } + else if ("Delta_r".Equals(quta.Name)) + { + + Delta_r + {{calcResult.Delta_r}} + + } + else if ("Delta_r(1bp)".Equals(quta.Name)) + { + + Delta_r(1bp) + {{calcResult.Delta_r_1bp}} + + } + else if ("Dv01".Equals(quta.Name)) + { + + Dv01 + {{calcResult.Dv01}} + + } + else if ("Gamma_r".Equals(quta.Name)) + { + + Gamma_r + {{calcResult.Gamma_r}} + + } + else if ("Gamma_r(1bp)".Equals(quta.Name)) + { + + Gamma_r(1bp) + {{calcResult.Gamma_r_1bp}} + + } + else if ("Vega_r".Equals(quta.Name)) + { + + Vega_r + {{calcResult.Vega_r}} + + } + else if ("Vega_r(1bp)".Equals(quta.Name)) + { + + Vega_r(1bp) + {{calcResult.Vega_r_1bp}} + + } } } diff --git a/YLErpWeb/wwwroot/Scripts/app/pricing/structure.js b/YLErpWeb/wwwroot/Scripts/app/pricing/structure.js index 9e0dbe2c..5652bb7f 100644 --- a/YLErpWeb/wwwroot/Scripts/app/pricing/structure.js +++ b/YLErpWeb/wwwroot/Scripts/app/pricing/structure.js @@ -1,4 +1,4 @@ - + //客户选择组件 const vueClient = function () { return { @@ -214,7 +214,7 @@ const vueMarginTemplateName = function () { } //计算结果字段 -const consCalcFields = Object.freeze(['TotalMargin', 'Pv', 'Delta', 'Gamma', 'Vega', 'Theta', 'Rho', 'PvContainsKnockOut', 'DeltaContainsKnockOut', 'DeltaInLots', 'GammaInLots', 'DeltaCash', 'GammaCash', 'VegaCash', 'GammaContainsKnockOut']); +const consCalcFields = Object.freeze(['TotalMargin', 'Pv', 'Delta', 'Gamma', 'Vega', 'Theta', 'Rho', 'PvContainsKnockOut', 'DeltaContainsKnockOut', 'DeltaInLots', 'GammaInLots', 'DeltaCash', 'GammaCash', 'VegaCash', 'GammaContainsKnockOut', 'Delta_r', 'Delta_r_1bp', 'Dv01', 'Gamma_r', 'Gamma_r_1bp', 'Vega_r', 'Vega_r_1bp']); var _trades, _tradeVues, _salesCommissionCtrl; //交易保存 @@ -1913,6 +1913,13 @@ function createVue(index, baseVue, floating) { calcResult.PvContainsKnockOut = pricingFormat.tradePrice(result.PvContainsKnockOut); calcResult.DeltaContainsKnockOut = pricingFormat.greek(result.DeltaContainsKnockOut); calcResult.GammaContainsKnockOut = pricingFormat.greek(result.GammaContainsKnockOut); + calcResult.Delta_r = result.Delta_r ? pricingFormat.greek(result.Delta_r) : ""; + calcResult.Delta_r_1bp = result.Delta_r_1bp ? pricingFormat.greek(result.Delta_r_1bp) : ""; + calcResult.Dv01 = result.Dv01 ? pricingFormat.greek(result.Dv01) : ""; + calcResult.Gamma_r = result.Gamma_r ? pricingFormat.greek(result.Gamma_r) : ""; + calcResult.Gamma_r_1bp = result.Gamma_r_1bp ? pricingFormat.greek(result.Gamma_r_1bp) : ""; + calcResult.Vega_r = result.Vega_r ? pricingFormat.greek(result.Vega_r) : ""; + calcResult.Vega_r_1bp = result.Vega_r_1bp ? pricingFormat.greek(result.Vega_r_1bp) : ""; calcResult.TotalMargin = 0; if (data === this.datas[this.datas.length - 1]) { calcResult.TotalMargin = pageVue.GetTotalMargin(_.map(this.datas, x => x.trade), this.structureType);