fix: 明确风险平价策略创建时权重总和必须等于1的校验逻辑
This commit is contained in:
parent
237bc47c14
commit
22db4e461e
@ -340,6 +340,7 @@ const validateRiskParityAssets = () => {
|
|||||||
totalWeight += parseFloat(asset.targetWeight);
|
totalWeight += parseFloat(asset.targetWeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 校验权重总和必须等于1(允许1%误差)
|
||||||
if (Math.abs(totalWeight - 1) > 0.01) {
|
if (Math.abs(totalWeight - 1) > 0.01) {
|
||||||
uni.showToast({ title: `资产权重总和必须为100%,当前为${(totalWeight * 100).toFixed(0)}%`, icon: 'none' });
|
uni.showToast({ title: `资产权重总和必须为100%,当前为${(totalWeight * 100).toFixed(0)}%`, icon: 'none' });
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user