- 添加 swapPricePrecisionHelper.js 工具类处理价格精度格式化 - 新增 swappriceprecision.js 配置文件定义各类金融产品的精度规则 - 在 EodPositionRisks.cshtml 和 SwapIncome.cshtml 中引入新的价格格式化脚本 - 替换原有的价格格式化函数为基于产品类型的动态精度控制 - 移除旧的价格验证和标准化逻辑,改用新的精度控制机制 - 添加 vue-swap-price-input 组件用于精确的价格输入控制 - 更新 Controller 中的价格处理逻辑以支持新精度格式化方式
47 lines
2.1 KiB
JavaScript
47 lines
2.1 KiB
JavaScript
// 通过 /front/swappriceprecision 加载。可按 UnderlyingInstrumentType 修改;缺项或非法值由页面精度组件回退内置默认规则。
|
|
window.main = window.main || {};
|
|
window.main.swapPricePrecision = {
|
|
Stock: { integerDigits: 7, precision: 2 },
|
|
StockIndex: { integerDigits: 7, precision: 2 },
|
|
StockIF: { integerDigits: 7, precision: 4 },
|
|
CommodityFutures: { integerDigits: 7, precision: 4 },
|
|
CommoditySpot: { integerDigits: 7, precision: 4 },
|
|
NewOtcStock: { integerDigits: 7, precision: 4 },
|
|
HKStock: { integerDigits: 7, precision: 4 },
|
|
HKStockIndex: { integerDigits: 7, precision: 4 },
|
|
Fund: { integerDigits: 7, precision: 4 },
|
|
Bond: {
|
|
grossPrice: { integerDigits: 6, precision: 9 },
|
|
netPrice: { integerDigits: 6, precision: 9 },
|
|
yield: { integerDigits: 2, precision: 6 }
|
|
},
|
|
TBonds: {
|
|
grossPrice: { integerDigits: 6, precision: 9 },
|
|
netPrice: { integerDigits: 6, precision: 9 },
|
|
yield: { integerDigits: 2, precision: 6 }
|
|
},
|
|
CreditBonds: {
|
|
grossPrice: { integerDigits: 6, precision: 9 },
|
|
netPrice: { integerDigits: 6, precision: 9 },
|
|
yield: { integerDigits: 2, precision: 6 }
|
|
},
|
|
OtherBonds: {
|
|
grossPrice: { integerDigits: 6, precision: 9 },
|
|
netPrice: { integerDigits: 6, precision: 9 },
|
|
yield: { integerDigits: 2, precision: 6 }
|
|
},
|
|
TBFutures: { integerDigits: 8, precision: 4 },
|
|
OtherFutures: { integerDigits: 8, precision: 4 },
|
|
GoldSpot: { integerDigits: 8, precision: 4 },
|
|
OtherSpot: { integerDigits: 8, precision: 4 },
|
|
AbroadFutures: { integerDigits: 8, precision: 4 },
|
|
AbroadSpot: { integerDigits: 8, precision: 4 },
|
|
AbroadStock: { integerDigits: 8, precision: 2 },
|
|
AbroadStockIndex: { integerDigits: 8, precision: 4 },
|
|
ExRate: { integerDigits: 2, precision: 8 },
|
|
Shibor: { integerDigits: 2, precision: 4 },
|
|
FixingRepoRate: { integerDigits: 2, precision: 4 },
|
|
|
|
// TODO: 利率收益率(6+8)、债券指数(6+4)、黄金期货(6+4)待对应的 UnderlyingInstrumentType 枚举确认后启用。
|
|
};
|