From 32a3a45c85e87fdb68e18dc8f4ed3ff2aacb6513 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=90=8D=E9=94=90?= <1565842059@qq.com>
Date: Thu, 23 Jul 2026 14:17:26 +0800
Subject: [PATCH] =?UTF-8?q?refactor(swap):=20=E4=BF=AE=E5=A4=8D=E5=80=BA?=
=?UTF-8?q?=E5=88=B8=E6=97=A5=E7=BB=88=E4=BB=B7=E6=A0=BC=E6=98=A0=E5=B0=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 移除 GetSwapValuationPrice 方法中的 posiGrossPrice 参数
- 删除债券价格转换相关的注释代码和日志记录
- 简化债券价格处理逻辑,直接使用原始价格进行四舍五入
- 更新所有调用 GetSwapValuationPrice 的地方以匹配新方法签名
- 移除多余的价格转换和展示态判断逻辑
---
.../SwapModule/SwapEodPositionService.cs | 24 +++++--------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs
index 2266fcc5..59aa0707 100644
--- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs
@@ -175,27 +175,15 @@ namespace YLErp.Modules.SwapModule
return UnderlyingCodePrice(code, settleDate, out vobp);
}
- ///
- /// 获取用于互换浮动腿盯市的标的价格。
- ///
- /// 普通债券类收益互换的新录入页面将全价按小数保存,例如页面录入 20% 后 PosiGrossPrice 为 0.2
- ///
- /// 因此仅当交易期初价已经是小数口径、且当前债券价明显仍处于展示态时,再做
- /// 一次展示态到存储态转换。期初价本身是历史展示态口径的存量交易保持原价格,
- /// 避免修改日终估值链路后改变其既有损益。
- ///
- private decimal GetSwapValuationPrice(string code, decimal posiGrossPrice, DateTime settleDate, out decimal vobp)
+ /// 获取用于互换浮动腿盯市的标的价格。
+ private decimal GetSwapValuationPrice(string code, DateTime settleDate, out decimal vobp)
{
var price = GetUnderlyingPrice(code, settleDate, out vobp);
var underlying = GetUnderlyingData(code);
- // var usesStoragePrice = Math.Abs(posiGrossPrice) < 2m;
- // var usesDisplayPrice = Math.Abs(price) >= 10m;
if (underlying?.IsBond() == true)
{
- var normalizedPrice = BondPriceConverter.ToStorage(price);
- Log.Error($"互换债券日终价格按展示态返回,已转换为存储态: UnderlyingCode={code}, ValueDate={settleDate:yyyy-MM-dd}, PosiGrossPrice={posiGrossPrice}, SourcePrice={price}, NormalizedPrice={normalizedPrice}");
- return Math.Round(normalizedPrice, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
+ return Math.Round(price, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
}
return Math.Round(price, ConsGlobal.SwapDeliveryPriceRound, MidpointRounding.AwayFromZero);
@@ -1575,7 +1563,7 @@ namespace YLErp.Modules.SwapModule
int shortRatio = eod.PositionType == (int)PositionTypeFlag.Long ? 1 : -1;
int directionRatio = eod.PosiDirection == (int)SwapDirectionEnum.收取 ? 1 : -1;
curretEod.PosiStatus = curretEod.PosiQuantity == 0 ? 1 : 0;
- var price = GetSwapValuationPrice(eod.UnderlyingCode, eod.PosiGrossPrice, dealDate, out decimal vobp);
+ var price = GetSwapValuationPrice(eod.UnderlyingCode, dealDate, out decimal vobp);
curretEod.dv01 = Dv01Helper.CalcDv01(eod.UnderlyingCode, curretEod.PosiQuantity, eod.PosiDirection, eod.PositionType, vobp);
decimal tax = um.ValueAddedTax ?? 0;
if (valueDate > td.StartDate.Value && curretEod.PosiQuantity > 0)
@@ -1667,7 +1655,7 @@ namespace YLErp.Modules.SwapModule
var dealDate = curretEod.ValueDate;
int shortRatio = eod.PositionType == (int)PositionTypeFlag.Long ? 1 : -1;
int directionRatio = eod.PosiDirection == (int)SwapDirectionEnum.收取 ? 1 : -1;
- var price = GetSwapValuationPrice(eod.UnderlyingCode, eod.PosiGrossPrice, dealDate, out decimal vobp);
+ var price = GetSwapValuationPrice(eod.UnderlyingCode, dealDate, out decimal vobp);
var todayConsumedDividend = CalcConsumedDividend(curretEod, unwindEvents);
var originNotional = (decimal)td.OriginalStockEqvNotional / swapPosition.PosiNetPrice;
decimal totalPayment = CalcBondPayment(curretEod.UnderlyingCode, td.StartDate.Value, valueDate, (decimal)originNotional, shortRatio, directionRatio);
@@ -1856,7 +1844,7 @@ namespace YLErp.Modules.SwapModule
curretEod.ContractSize = position.ContractSize;
curretEod.CountRatio = position.CountRatio;
curretEod.PosiTradingFee = position.PosiTradingFee;
- curretEod.UnderlyingPrice = GetSwapValuationPrice(position.UnderlyingCode, position.PosiGrossPrice, dealDate, out decimal vobp);
+ curretEod.UnderlyingPrice = GetSwapValuationPrice(position.UnderlyingCode, dealDate, out decimal vobp);
SetPriceInfoByFlowEvent(eod, curretEod, unwindEvents, position);
curretEod.dv01 = Dv01Helper.CalcDv01(curretEod.UnderlyingCode, curretEod.PosiQuantity, curretEod.PosiDirection, curretEod.PositionType, vobp);
//if (settleDate == td.TradeDate)