#EQD-6669 国联民生-期权希腊值计算步长和细节调整(定价引擎部分)

This commit is contained in:
yexuzhong
2026-07-31 10:35:25 +08:00
parent ca74095e0c
commit 5d580960d8
17 changed files with 236 additions and 63 deletions
@@ -1,4 +1,4 @@
using BaseOUDAL;
using BaseOUDAL;
using System;
using System.Data;
using System.Diagnostics;
@@ -339,7 +339,9 @@ namespace YLErp.Modules.EodModule
var tcActions = new[] { ClientCashInCashOut._平仓费,
ClientCashInCashOut._行权费,ClientCashInCashOut._票息,ClientCashInCashOut._互换,ClientCashInCashOut._其他};
var underlyingCodes = searchResult.rows.Select(O => O.UnderlyingCode).Distinct().ToList();
var greeksHandleService = new GLMSGreeksHandleService();
greeksHandleService.InitData(req.ValueDate, underlyingCodes);
foreach (var r in searchResult.rows)
{
var um = DataCacheProvider.GetUnderlyingDataSource().GetData(r.UnderlyingCode);
@@ -470,6 +472,7 @@ namespace YLErp.Modules.EodModule
r.DeltaLots = (r.Delta ?? 0) / um.ContractSize;
}
r.Rho *= 100;
greeksHandleService.Handle(r);
if (r.trade == null)
{
r.TradeSinglePrice = r.etcTradePrice / r.TradeAmount;
@@ -1118,6 +1121,9 @@ namespace YLErp.Modules.EodModule
.AsEnumerable()
.GroupBy(O => O.ParentTradeId)
.ToDictionary(K => K.Key, V => V.Select(O => new xodTradeBase() { TradeJson = O.TradeJson }));
var underlyingCodes = searchResult.rows.Select(O => O.UnderlyingCode).Distinct().ToList();
var greeksHandleService = new GLMSGreeksHandleService();
greeksHandleService.InitData(req.ValueDate, underlyingCodes);
foreach (var r in searchResult.rows)
{
@@ -1200,6 +1206,7 @@ namespace YLErp.Modules.EodModule
}
r.Rho *= 100;
greeksHandleService.Handle(r);
r.CountRatio = um.CountRatio;
r.TradeOriginalAmount = r.OriginalNotional / um.CountRatio;
r.etcTradePrice = ConsTrade.TradeTypesForHedge.Contains(r.TradeType)
@@ -1706,10 +1713,10 @@ namespace YLErp.Modules.EodModule
var results = GetEodPositionRisksDataHandle(req);
var list2 = results.Select(n => new ExpandoDictionary<string, string>(n)).ToArray();
var templateFile = OtcAppContext.MapPath("~/App_Docs/导出模板/日终持仓风险.xlsx");
var templateFile = OtcAppContext.MapPath("~/App_Docs/导出模板/日终持仓风险_国联.xlsx");
if (PS.Config.ErpElement.NeedShowSpv)
{
templateFile = OtcAppContext.MapPath("~/App_Docs/导出模板/日终持仓风险-Spv.xlsx");
templateFile = OtcAppContext.MapPath("~/App_Docs/导出模板/日终持仓风险-Spv_国联.xlsx");
}
return ExcelGenerator.UseTemplateGenerator(templateFile).AddVariable(new { list = list2 }).GenerateBytes();
@@ -2016,6 +2023,17 @@ namespace YLErp.Modules.EodModule
dic.Add("Spv3", item.PnLDelta.OtcFormat(OtcFormatFlag.greek));
}
if (PS.Config.Company == Configuration.CompanyEnum.)
{
dic.Add("Delta_r", OtcFormatExtensions.OtcFormat(item.Delta_r, OtcFormatFlag.greek));
dic.Add("Delta_r_1bp", OtcFormatExtensions.OtcFormat(item.Delta_r_1bp, OtcFormatFlag.greek));
dic.Add("Dv01", OtcFormatExtensions.OtcFormat(item.Dv01, OtcFormatFlag.greek));
dic.Add("Gamma_r", OtcFormatExtensions.OtcFormat(item.Gamma_r, OtcFormatFlag.greek));
dic.Add("Gamma_r_1bp", OtcFormatExtensions.OtcFormat(item.Gamma_r_1bp, OtcFormatFlag.greek));
dic.Add("Vega_r", OtcFormatExtensions.OtcFormat(item.Vega_r, OtcFormatFlag.greek));
dic.Add("Vega_r_1bp", OtcFormatExtensions.OtcFormat(item.Vega_r_1bp, OtcFormatFlag.greek));
}
dic.Add("备注", item.Comments);
@@ -2115,6 +2133,17 @@ namespace YLErp.Modules.EodModule
dic.Add("Spv2", "");
dic.Add("Spv3", "");
}
if (PS.Config.Company == Configuration.CompanyEnum.)
{
dic.Add("Delta_r", "");
dic.Add("Delta_r_1bp", "");
dic.Add("Dv01", "");
dic.Add("Gamma_r", "");
dic.Add("Gamma_r_1bp", "");
dic.Add("Vega_r", "");
dic.Add("Vega_r_1bp", "");
}
results.Add(dic);
}
return results;