refactor(swap): 统一债券价格处理逻辑
- 将债券价格处理逻辑从依赖 StructureType 改为基于 IsBond 判断 - 移除 SetPosiPrice 方法中的 useBondPriceScale 参数 - 更新收入互换交易中的 multiplier 计算方式 - 调整平仓交易中 isBondTRS 的判断条件 - 同步修改相关注释说明
This commit is contained in:
@@ -3605,9 +3605,10 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
item.FloatRateAbs = item.position.PosiNotionalValue == 0 ? 0 : item.InterestAmount / item.position.PosiNotionalValue;
|
||||
}
|
||||
// 交易录入的债券类收益互换价格以小数保存,展示时转为百分比价格;
|
||||
// 普通收益互换录入的是数量/原始数值,不做乘 100 转换。
|
||||
SetPosiPrice(item.position, item.StructureType == "普通债券类收益互换");
|
||||
// 是否 ×100 由标的资产类型决定(债券价格以小数保存,展示时转为百分比价格),
|
||||
// 与存储层 GetStorageDeliveryPriceRound / GetSwapValuationPrice 的 IsBond 口径一致,
|
||||
// 不依赖簿记结构类型 StructureType。
|
||||
SetPosiPrice(item.position);
|
||||
}
|
||||
return retListResult;
|
||||
}
|
||||
@@ -3652,10 +3653,10 @@ namespace YLErp.Modules.SwapModule
|
||||
position.SwapPositionValue = -position.SwapPositionValue;
|
||||
position.PosiDividendSum = -position.PosiDividendSum;
|
||||
}
|
||||
private void SetPosiPrice(eod_swap_position position, bool? useBondPriceScale = null)
|
||||
private void SetPosiPrice(eod_swap_position position)
|
||||
{
|
||||
var um = DataCacheProvider.GetUnderlyingDataSource().GetData(position.UnderlyingCode);
|
||||
if (useBondPriceScale ?? (um != null && um.IsBond()))
|
||||
if (um != null && um.IsBond())
|
||||
{
|
||||
position.PosiNetPrice *= 100;
|
||||
position.UnderlyingPrice *= 100;
|
||||
|
||||
@@ -46,7 +46,9 @@ const vue = new Vue({
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.multiplier = this.deal.StructureType == '普通债券类收益互换' ? 100 : 1;
|
||||
// 是否 ×100 由浮动腿标的资产类型决定(债券价格以小数保存,展示时转为百分比),
|
||||
// 与存储层 SetPosiPrice/GetStorageDeliveryPriceRound 的 IsBond 口径一致,不依赖簿记结构类型。
|
||||
this.multiplier = this.IsBond(swapInstrumentType) ? 100 : 1;
|
||||
this.initDeal();
|
||||
this.setValueDate();
|
||||
},
|
||||
|
||||
@@ -64,7 +64,7 @@ const vue = new Vue({
|
||||
marginList: [],
|
||||
initPosiNetPrice: 0,
|
||||
multiplier: 1,
|
||||
// EQD-6953 簿记模板=普通债券类收益互换 时启用 期末交割全价↔结算收益率(ExitYtm) 互算
|
||||
// EQD-6953 浮动腿标的为债券时启用 期末交割全价↔结算收益率(ExitYtm) 互算
|
||||
isBondTRS: false,
|
||||
// 平仓比例展示/输入均为"占期初(original)"语义(A):默认与每次重开都基于原始名义本金。
|
||||
// oriClosePercent = 剩余名义本金/期初名义本金 = 最多可平比例(不能平超过剩余持仓)。
|
||||
@@ -77,13 +77,15 @@ const vue = new Vue({
|
||||
minStartDate() {
|
||||
return this.deal.StartDate;
|
||||
},
|
||||
// EQD-6953:簿记模板为普通债券类收益互换 且 浮动腿标的为债券 时,才展示 源/AUTO/REV 标识并允许互算
|
||||
// EQD-6953:浮动腿标的为债券时,才展示 源/AUTO/REV 标识并允许互算
|
||||
isBondUnwindLeg() {
|
||||
return this.isBondTRS && !!this.floatPosition && this.IsBond(this.floatPosition.UnderlyingInstrumentType);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.isBondTRS = this.deal.StructureType == '普通债券类收益互换';
|
||||
// 是否债券收益互换由浮动腿标的资产类型决定(×100 展示口径与存储层 SetPosiPrice 的 IsBond 一致),
|
||||
// 不依赖簿记结构类型 StructureType。
|
||||
this.isBondTRS = this.IsBond(swapInstrumentType);
|
||||
this.multiplier = this.isBondTRS ? 100 : 1;
|
||||
this.initDeal();
|
||||
this.setValueDate(this.deal.ValueDate);
|
||||
|
||||
Reference in New Issue
Block a user