恢复对债券首次读取接口返回的 price / netPrice 本来就是存储态小数 (EodPrice 直接返回 DB 值;非 EodPrice 分支 ×bondPriceMultiple=0.01

This commit is contained in:
hjhan
2026-07-22 15:04:42 +08:00
parent e331c15a15
commit 63d9decd17
@@ -718,15 +718,13 @@ const vue = new Vue({
var thisObj = this;
main.post("/pricing/AjaxGetUnderlyingPrice", { underlyingCode: underlyingCode, tradeDate: StartDate })
.done(function (resp) {
if (item.isBond) {
// 债券行情返回的是【展示态/每百元百分比】(如 100),而 PosiNetNoFeePrice/PosiGrossPrice
// 模型字段存【存储态小数】(如 1.0)。非债券标的保持原 umprice 格式化即可。
item.PosiNetNoFeePrice = SwapCalc.bondCalcPriceToStorage(resp.obj.netPrice);
item.PosiGrossPrice = SwapCalc.bondCalcPriceToStorage(resp.obj.price);
} else {
item.PosiNetNoFeePrice = otcformat.trading.umprice(resp.obj.netPrice);
item.PosiGrossPrice = otcformat.trading.umprice(resp.obj.price);
}
// 行情接口(AjaxGetUnderlyingPrice)对债券返回的 price/netPrice 本就是【存储态小数】(1.0 代表 100 元),
// 与 PosiGrossPrice/PosiNetNoFeePrice 模型字段同量纲(见 PricingController: EodPrice 直接返回、
// 非 EodPrice 分支 ×bondPriceMultiple=0.01)。故此处仅做精度格式化,**不可**再 bondCalcPriceToStorage(÷100)
// 否则默认价 1.0 被除成 0.01,界面 percent:true 再 ×100 显示为 1"被自动除以100"bug)。
// 计算器(/Bond/CalcBond)返回的才是展示态,其 ÷100 落库逻辑在 calcBondForItem 内处理。
item.PosiNetNoFeePrice = otcformat.trading.umprice(resp.obj.netPrice);
item.PosiGrossPrice = otcformat.trading.umprice(resp.obj.price);
thisObj.calcNotional();
});
},