fix(期权到期): 债券标的到期取价补查中债估值表,并标注债券净/全价映射不一致(Layer2)

- EodPriceQueryService 新增 TryGetSettlementEodPrice:债券走中债估值、期货/股票走原路径
- 单笔 tradeExpireInner + 批量 MultipleTradeExpireConfirm 改用统一方法,修 GLMS-20260715-0002 债券期权到期报'结算价未找到'
- 移除批量路径未初始化的 EodPriceProvider(对债券无效且有误导性的 footgun)
- Layer2:标注 EodPriceProvider.Initialize 与 GetBondPrice 债券 ClosePrice/SettlePrice 净全价定义相反,待统一(不改逻辑)
- 新增白盒单测覆盖债券标的到期取价(3用例 DB驱动,均通过)
This commit is contained in:
hjhan
2026-07-16 14:41:44 +08:00
parent 98122ef509
commit a17cdc2b74
4 changed files with 100 additions and 5 deletions
@@ -114,6 +114,23 @@ namespace YLErp.Modules.DataProviderModule
return (eodPrice = GetBondPrice(valueDate, underlyingCode)) != null;
}
/// <summary>
/// 统一日终结算取价(债券感知)。
/// 用于交易/期权到期结算:债券标的走中债估值表(TryGetBondEodPrice),期货/股票走原 InnerGetEodPrice。
/// 解决到期路径(tradeExpireInner / MultipleTradeExpireConfirm)漏查债券表导致"结算价未找到"的问题。
/// 注:债券 ClosePrice/SettlePrice 映射沿用 GetBondPrice 口径(ClosePrice=全价 dirty_price_closeSettlePrice=净价 net_price),
/// 与 EodPriceProvider 的映射(ClosePrice=净价,SettlePrice=全价)相反——属历史不一致(见 EodPriceProvider.Initialize 与 GetBondPrice 的注释),
/// 本方法保持与系统既有"债券现价"约定(UnderlyingCodePrice)一致,不引入新口径。
/// </summary>
public static bool TryGetSettlementEodPrice(DateTime valueDate, string underlyingCode, out EodPrice eodPrice)
{
var um = DataCacheProvider.GetUnderlyingDataSource().GetData(underlyingCode);
if (um != null && ConsGlobal.InstrumentType.IsBond(um.UnderlyingInstrumentType))
{
return TryGetBondEodPrice(valueDate, underlyingCode, out eodPrice);
}
return TryGetEodPrice(valueDate, underlyingCode, out eodPrice);
}
/// <summary>
/// 尝试获取标的某日的日终价
/// </summary>
public static bool TryGetEodPrice(DateTime valueDate, int underlyingId, out EodPrice eodPrice)
@@ -231,6 +248,9 @@ namespace YLErp.Modules.DataProviderModule
Vobp = bondPrice.vobp,
ValueDate = valueDate,
UnderlyingCode = underlyingCode,
// [Layer2-待统一] 债券映射口径:ClosePrice=全价(dirty_price_close)SettlePrice=净价(net_price)。
// 注意:这与 EodPriceProvider.Initialize 的映射【完全相反】(EodPriceProvider: ClosePrice=净价,SettlePrice=全价)。
// 两处对"债券收盘价/结算价"的净全价定义不一致属历史遗留,请勿随意改动单侧,需业务先定调后统一(见 TryGetSettlementEodPrice 注释)。
ClosePrice = Convert.ToDouble(BondPriceConverter.ToStorage(bondPrice.dirty_price_close)),
SettlePrice = Convert.ToDouble(BondPriceConverter.ToStorage(bondPrice.net_price)),
ReferencePrice = Convert.ToDouble(BondPriceConverter.ToStorage(bondPrice.yield))