feat(swap): 统一【期初、期末交割价格】精度处理

- 在ConsGlobal中新增SwapDeliveryPriceRound常量定义为9位小数
- 更新incomeSwapTrade.js中交割价格计算逻辑,添加getStorageDeliveryPrice方法
- 修改SwapConsumerService中TradingAmountAvg字段的精度处理
- 添加ValidateDeliveryPrices和NormalizeDeliveryPrices方法进行交割价格验证和标准化
- 在SwapEodPositionService中对PosiGrossPrice和UnderlyingPrice进行精度处理
- 更新SwapFlowEventService中TradingAmountAvg字段的精度处理
- 在SwapFlowImportService中添加交割价格精度处理
- 更新前端界面中的输入格式配置,使用新的交割价格精度设置
- 修改SwapflowList.js中交割价格精度处理逻辑
- 在SwapFlowService中添加交割价格验证和精度处理
- 更新SwapTradeAutoService中交割价格精度处理
- 修改SwapTradeService中PosiGrossPrice字段的精度处理
- 更新unwindSwapTrade.js中交割价格计算逻辑
This commit is contained in:
张名锐
2026-07-22 14:53:46 +08:00
parent 0755233ab6
commit c58a9d40c4
17 changed files with 127 additions and 44 deletions
@@ -473,7 +473,7 @@ namespace YLErp.Modules.SwapModule
swap_Flow.UnderlyingCode = req.UnderlyingCode;
swap_Flow.BsType = req.BsType;
swap_Flow.ContractSize = req.ContractSize;
swap_Flow.TradingAmountAvg = req.TradingAmountAvg;
swap_Flow.TradingAmountAvg = Math.Round(req.TradingAmountAvg, ConsGlobal.SwapDeliveryPriceRound, MidpointRounding.AwayFromZero);
swap_Flow.TradingAmountFeeAvg = TradeFeeHelper.CalcPriceWithFee(req.TradingFee,req.TradingAmountAvg,req.TradingQty,req.BsType);
swap_Flow.ClientId = req.ClientId;
swap_Flow.ytm = req.ytm;
@@ -540,7 +540,7 @@ namespace YLErp.Modules.SwapModule
swap_Flow.BsType = req.BsType;
swap_Flow.DataState = (int)SwapFlowDateStateEnum.;
swap_Flow.ContractSize = req.ContractSize;
swap_Flow.TradingAmountAvg = req.TradingAmountAvg;
swap_Flow.TradingAmountAvg = Math.Round(req.TradingAmountAvg, ConsGlobal.SwapDeliveryPriceRound, MidpointRounding.AwayFromZero);
swap_Flow.TradingAmountFeeAvg = req.TradingAmountFeeAvg;
UpdateDbOption(swap_Flow);
if (req.id == 0)
@@ -695,7 +695,7 @@ namespace YLErp.Modules.SwapModule
TradingFee = gourpItem.Sum(s => s.TradingFee),
DataState = (int)SwapFlowDateStateEnum.,
TradingAmountFeeAvg = gourpItem.Average(s => s.TradingAmountFeeAvg),
TradingAmountAvg = gourpItem.Average(s => s.TradingAmountAvg),
TradingAmountAvg = Math.Round(gourpItem.Average(s => s.TradingAmountAvg), ConsGlobal.SwapDeliveryPriceRound, MidpointRounding.AwayFromZero),
ContractSize = swapflow.ContractSize
};
UpdateDbOption(swap_flow_summary);
@@ -747,6 +747,11 @@ namespace YLErp.Modules.SwapModule
private void CheckValid(swap_flow req)
{
CheckRequired(req);
var roundedPrice = Math.Round(req.TradingAmountAvg, ConsGlobal.SwapDeliveryPriceRound, MidpointRounding.AwayFromZero);
if (req.TradingAmountAvg != roundedPrice)
{
throw new ServiceException($"成交全价最多保留{ConsGlobal.SwapDeliveryPriceRound}位小数");
}
var underlying = DataCacheProvider.GetUnderlyingDataSource().GetData(req.UnderlyingCode);
if (underlying == null)
{
@@ -764,6 +769,7 @@ namespace YLErp.Modules.SwapModule
// 数量×100(万手→手),与价格维度无关,保留常量
req.TradingQty *= ConsGlobal.bondShowPriceMultiple;
}
req.TradingAmountAvg = Math.Round(req.TradingAmountAvg, ConsGlobal.SwapDeliveryPriceRound, MidpointRounding.AwayFromZero);
}