cleanup: 删除 SwapInterestAdapter 半成品, 回退 SwapInterest 未提交改动
SwapInterestAdapter + SwapInterest 增强(annualized/segmentRates/ resetCarryInterest) + 配套测试 是半成品, 有G7/G8已知边界, 且破坏现有测试。按审查建议回退, 作为独立PR后续处理。 当前工作区只剩 BondIndex/RateYield 到期日修复。 验证: 编译0错误, 全量513测试7失败(基线一致)。
This commit is contained in:
@@ -356,6 +356,22 @@ namespace YLErp
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否债券指数资产类型(永续,无到期日)。
|
||||
/// 注:ConvertCalcType 将其映射为 CommodityFutures 以复用计算路径,
|
||||
/// 但保存校验不应据此强制要求到期日。
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsBondIndex(string instType)
|
||||
=> BondIndex.Equals(instType, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// 是否利率收益率曲线资产类型(无到期日)。
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsRateYield(string instType)
|
||||
=> RateYield.Equals(instType, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
//------------CalcType-----------------------
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -488,6 +488,19 @@ namespace YLErp.DBModels
|
||||
return ConsGlobal.InstrumentType.CalcTypeIsFutures(UnderlyingInstrumentType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标的是否需要在保存时填写到期日。
|
||||
/// 仅真正的期货合约需要;BondIndex(债券指数)/ RateYield(利率曲线)虽被
|
||||
/// ConvertCalcType 映射为 CommodityFutures 以复用计算路径,但二者永续无到期日,
|
||||
/// 不应强制要求。集中此处作为唯一判定,避免 IsFutures() 判断在多处被重复收窄。
|
||||
/// </summary>
|
||||
public bool RequiresMaturityDate()
|
||||
{
|
||||
return ConsGlobal.InstrumentType.CalcTypeIsFutures(UnderlyingInstrumentType)
|
||||
&& !ConsGlobal.InstrumentType.IsBondIndex(UnderlyingInstrumentType)
|
||||
&& !ConsGlobal.InstrumentType.IsRateYield(UnderlyingInstrumentType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标的是否债券类型
|
||||
/// </summary>
|
||||
|
||||
@@ -943,7 +943,7 @@ namespace YLErp.Modules.SwapModule
|
||||
throw new ServiceException("标的信息不存在:" + req.UnderlyingCode);
|
||||
}
|
||||
|
||||
if (_underlying.IsFutures() && _underlying.MaturityDate == null)
|
||||
if (_underlying.RequiresMaturityDate() && _underlying.MaturityDate == null)
|
||||
{
|
||||
throw new ServiceException("标的到期日不存在:" + req.UnderlyingCode);
|
||||
}
|
||||
@@ -952,7 +952,7 @@ namespace YLErp.Modules.SwapModule
|
||||
req.VarietyId = _underlying.UnderlyingTypeId;
|
||||
req.UnderlyingAssetClass = _underlying.UnderlyingType;
|
||||
req.UnderlyingAssetName = _underlying.UnderlyingName;
|
||||
req.MaturityDate = _underlying.IsFutures() ? _underlying.MaturityDate : null;
|
||||
req.MaturityDate = _underlying.RequiresMaturityDate() ? _underlying.MaturityDate : null;
|
||||
req.UnderlyingInstrumentType = _underlying.GetMainType();
|
||||
req.CountRatio = _underlying.CountRatio;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user