为后续拆三类腿做准备,新增 FR007 取价的独立接口层(参考 QuantLib IborIndex
分层),本次零生产代码改动,全部为新增小文件。
新增文件(取价接缝,供后续 SwapDealService 6 处 inline 取价迁移用):
- Framework/YLErp.Core/Interest/IIndexFixer.cs
接口定义:给定取价日和标的代码返回当日利率,取价与计息解耦
- Framework/YLErp.Core/Interest/IndexFixerBase.cs
取价日计算工具:收敛原散落 6 处的 GetNonHolidayDefore(date.AddDays(rule))
- YLErpDAL/Modules/SwapModule/Fr007IndexFixer.cs
生产实现 + GetFixingOrThrow 辅助方法,独立文件便于单测
测试清理(删除基于错误假设的测试):
- 删除 SwapFixedInterestLegClosePercentBugTest.cs 整个文件
该文件假设'固定值腿利息应随平仓比例线性缩放',但固定值是合同写死的、
永远不随平仓比例变化。d1badfe4 的'修复'本身才是错的,当前分支已正确回退
- 修正 SwapUnwindPrepayPrincipalBugTdd.cs 固定值测试方法
断言从'应=Fix×0.5'改为'恒=Fix不随比例变化',对齐正确的业务定义
已知失败(非本次引入,留待后续与拆腿一起修):
- BondTrsAutoSwapScenarioTest 的 AS_001/004/008/009/010/011 共 6 个
原因:SaveAutoSwapDeal 直接调 AddClientCashInCashOut(非virtual)绕过
AddClientCash(virtual)封装,无库环境抛'客户信息未找到'。
从 096d2609 引入时即失败,需 AddClientCashInCashOut 加 virtual + 客户数据
mock,与拆腿那次可测性改造一起做
21 lines
760 B
C#
21 lines
760 B
C#
using YLErp.QdpModule;
|
|
|
|
namespace YLErp.Derivatives.Interest;
|
|
|
|
/// <summary>
|
|
/// 取价日计算工具,供 IIndexFixer 实现复用。
|
|
/// 收敛原 SwapDealService 里散落 6 处的 GetNonHolidayDefore(date.AddDays(rule))。
|
|
/// </summary>
|
|
public abstract class IndexFixerBase
|
|
{
|
|
/// <summary>
|
|
/// 重置日 + 利率规则 → 取价日(工作日回拨)。
|
|
/// interestRule: 0 = 当前营业日,-1 = 前一营业日。
|
|
/// </summary>
|
|
public static DateTime GetFixingDate(DateTime resetDate, int interestRule)
|
|
=> QdpCalendarHelper.GetNonHolidayDefore(resetDate.AddDays(interestRule));
|
|
|
|
public static DateTime GetFixingDate(DateTime resetDate, int? interestRule)
|
|
=> GetFixingDate(resetDate, interestRule ?? 0);
|
|
}
|