refactor(swap): GetInterests 传参语义显式化——盘中/EOD平仓后收盘拆双显式入口
问题:GetInterests 同名参数在两类调用方下语义相反,约定只存在于注释(2035e1df 固化):
盘中(:489链) EOD平仓后收盘(:1311链)
posiNotionalValue 平仓前剩余本金 vs 平仓后剩余本金
closePercent 实际平仓比例(B) vs 恒1(全额结息)
均走 settment:false 盘中重放算法。6fdc7d80 修的错账即两语义混用产物,
mode2 无条件覆盖/mode9 全平兜底是粘合补丁。
改动(纯机械,零行为变化):
- SwapDealService 新增 GetIntradayUnwindInterests(preCloseNotional/closedNotional/
closePercentRemaining 具名),GetUnwindInterests 切换调用;needPrice/grossPrice 为
GetInterests 死参数(体内零消费),新入口不再暴露
- SwapEodPositionService 新增虚接缝 CalcEodPostCloseSettleInterests
(remainingNotionalAfterClose/closedNotional/恒1),默认实现经 CalcSwapInterests
转发——既有测试替身对该接缝的拦截不变;SaveAutoEodWithCloseInterestPosition 切换调用
- 原 GetInterests/CalcSwapInterests 签名与行为不动(测试直调兼容);EOD 增量路径
(:1148/:1563, settment:true, closePosi=posi 同值) 语义自洽,本次不动
验证:全量 899 测试 145失败/742通过/12跳过——与 e2431e9d 基线逐位一致,零回归。
This commit is contained in:
@@ -486,7 +486,10 @@ namespace YLErp.Modules.SwapModule
|
||||
&& eventTypes.Contains(x.EventType)
|
||||
&& x.DataState == (int)SwapFlowDateStateEnum.完成).ToList();
|
||||
bool tdClose = closeList.Count > 0;
|
||||
interests = GetInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions, stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue, closePercent, eventType, tdClose, false, grossPrice ?? 0, orginPv, true, false,false, closeList);
|
||||
// 显式入口(语义见 GetIntradayUnwindInterests 注释):平仓前剩余本金 + 实际平掉额 + B语义比例,盘中重放
|
||||
interests = GetIntradayUnwindInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions,
|
||||
stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue,
|
||||
closePercent, eventType, tdClose, orginPv, add: true, newCalcLast: false, closeList);
|
||||
return interests;
|
||||
}
|
||||
|
||||
@@ -616,6 +619,40 @@ namespace YLErp.Modules.SwapModule
|
||||
/// <param name="tdClose"></param>
|
||||
/// <param name="add"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// 【盘中平仓/互换结息】显式入口——GetInterests(settment:false) 盘中语义的具名封装(2026-08 显式化重构)。
|
||||
///
|
||||
/// 语义契约(与 EOD 平仓后收盘的 CalcEodPostCloseSettleInterests 相反,勿混用):
|
||||
/// preCloseNotional = 平仓【前】实时剩余本金(原 GetUnwindInterests 的 stockEqvNotional);
|
||||
/// closedNotional = 本次实际平掉本金(= preCloseNotional × closePercentRemaining);
|
||||
/// closePercentRemaining = 平仓比例,B 语义【占剩余】(前端传 A 占期初,须先经 ToRemainingClosePercent 转换);
|
||||
/// 计息走 CalcUnwindInterest 全区间重放(orginPv 参与保证金腿差分)。
|
||||
///
|
||||
/// needPrice/grossPrice 为 GetInterests 的历史死参数(方法体内无消费),本入口不再暴露。
|
||||
/// </summary>
|
||||
public List<swap_flow_event> GetIntradayUnwindInterests(
|
||||
trade td,
|
||||
trade_extend tradeExtend,
|
||||
DateTime valueDate,
|
||||
DateTime unwindDate,
|
||||
List<eod_swap_position> eodPositions,
|
||||
List<swap_position> positions,
|
||||
decimal preCloseNotional,
|
||||
decimal preCloseLongNotional,
|
||||
decimal preCloseShortNotional,
|
||||
decimal closedNotional,
|
||||
decimal closePercentRemaining,
|
||||
int eventType,
|
||||
bool tdClose,
|
||||
decimal orginPv,
|
||||
bool add,
|
||||
bool newCalcLast,
|
||||
List<swap_flow_event> closeList)
|
||||
=> GetInterests(td, tradeExtend, valueDate, unwindDate, eodPositions, positions,
|
||||
preCloseNotional, preCloseLongNotional, preCloseShortNotional, closedNotional,
|
||||
closePercentRemaining, eventType, tdClose, needPrice: false, grossPrice: 0m,
|
||||
orginPv, add, settment: false, newCalcLast, closeList);
|
||||
|
||||
public List<swap_flow_event> GetInterests(
|
||||
trade td,
|
||||
trade_extend tradeExtend,
|
||||
|
||||
Reference in New Issue
Block a user