Update index.html
Browse files- index.html +59 -70
index.html
CHANGED
|
@@ -291,6 +291,12 @@
|
|
| 291 |
background: #e8f5e9;
|
| 292 |
color: #2e7d32;
|
| 293 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
</style>
|
| 295 |
</head>
|
| 296 |
<body>
|
|
@@ -557,15 +563,11 @@
|
|
| 557 |
const p25 = normalQuantile(0.25, annualMean, annualStd);
|
| 558 |
const p75 = normalQuantile(0.75, annualMean, annualStd);
|
| 559 |
|
| 560 |
-
// 计算正收益概率
|
| 561 |
-
const positiveProb = (1 - normalCDF(0, annualMean, annualStd)) * 100;
|
| 562 |
-
|
| 563 |
return {
|
| 564 |
lower: p25 / 100, // 转换为百分比
|
| 565 |
upper: p75 / 100,
|
| 566 |
mean: annualMean / 100,
|
| 567 |
-
std: annualStd / 100
|
| 568 |
-
positiveProbability: positiveProb.toFixed(1)
|
| 569 |
};
|
| 570 |
}
|
| 571 |
|
|
@@ -637,19 +639,19 @@
|
|
| 637 |
// 资产预期收益率区间(使用您提供的数据)
|
| 638 |
const assetReturnRanges = {
|
| 639 |
'CONVERTIBLE_BOND': {
|
| 640 |
-
'PESSIMISTIC': { min: 5, max: 8
|
| 641 |
-
'NEUTRAL': { min: 8, max: 11
|
| 642 |
-
'OPTIMISTIC': { min: 11, max: 14
|
| 643 |
},
|
| 644 |
'EQUITY': {
|
| 645 |
-
'PESSIMISTIC': { min: 5, max: 10
|
| 646 |
-
'NEUTRAL': { min: 10, max: 15
|
| 647 |
-
'OPTIMISTIC': { min: 15, max: 20
|
| 648 |
},
|
| 649 |
'REITS': {
|
| 650 |
-
'PESSIMISTIC': { min: 4, max: 6
|
| 651 |
-
'NEUTRAL': { min: 6, max: 8
|
| 652 |
-
'OPTIMISTIC': { min: 8, max: 10
|
| 653 |
}
|
| 654 |
};
|
| 655 |
|
|
@@ -759,7 +761,6 @@
|
|
| 759 |
totalReturn: `${totalLower.toFixed(2)}% ~ ${totalUpper.toFixed(2)}%`,
|
| 760 |
totalLower: totalLower,
|
| 761 |
totalUpper: totalUpper,
|
| 762 |
-
positiveProbability: capGain.positiveProbability + '%',
|
| 763 |
marketRef: `${marketRef.pure_bond[period][0]}% - ${marketRef.pure_bond[period][1]}%`,
|
| 764 |
hasCapitalGain: true
|
| 765 |
};
|
|
@@ -770,12 +771,8 @@
|
|
| 770 |
const bondResult = calculateBaseReturn();
|
| 771 |
const capGain = calculateCapitalGainRange(period);
|
| 772 |
|
| 773 |
-
//
|
| 774 |
-
const pureBondReturn = bondResult.baseReturn + capGain.upper;
|
| 775 |
-
|
| 776 |
-
// 获取资产预期收益率(使用中性值)
|
| 777 |
const assetRange = assetReturnRanges[asset][expectation];
|
| 778 |
-
const assetReturn = (assetRange.min + assetRange.max) / 2; // 取区间中值
|
| 779 |
|
| 780 |
// 配置比例
|
| 781 |
let bondWeight, assetWeight;
|
|
@@ -790,15 +787,24 @@
|
|
| 790 |
assetWeight = 20;
|
| 791 |
}
|
| 792 |
|
| 793 |
-
// 计算
|
| 794 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 795 |
|
| 796 |
-
// 计算
|
| 797 |
-
const bondContribution = pureBondReturn * bondWeight / 100;
|
| 798 |
-
const assetContribution = assetReturn * assetWeight / 100;
|
| 799 |
-
const capitalGainContribution = capGain.upper * bondWeight / 100;
|
| 800 |
const baseBondContribution = bondResult.baseReturn * bondWeight / 100;
|
| 801 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 802 |
return {
|
| 803 |
strategy: '固收+策略',
|
| 804 |
period: state.getPeriodLabel(period),
|
|
@@ -809,20 +815,15 @@
|
|
| 809 |
bondWeight: bondWeight + '%',
|
| 810 |
assetWeight: assetWeight + '%',
|
| 811 |
baseBondReturn: bondResult.baseReturn.toFixed(2) + '%',
|
| 812 |
-
capitalGain: (capGain.upper * 100).toFixed(2) + 'bp',
|
| 813 |
-
capitalGainValue: capGain.upper,
|
| 814 |
-
pureBondReturn: pureBondReturn.toFixed(2) + '%',
|
| 815 |
-
assetReturnRange: assetRange.label,
|
| 816 |
-
assetReturn: assetReturn.toFixed(2) + '%',
|
| 817 |
-
totalReturn: totalReturn.toFixed(2) + '%',
|
| 818 |
-
|
| 819 |
-
// 贡献分解
|
| 820 |
-
bondContribution: bondContribution.toFixed(2) + '%',
|
| 821 |
-
assetContribution: assetContribution.toFixed(2) + '%',
|
| 822 |
-
capitalGainContribution: capitalGainContribution.toFixed(2) + '%',
|
| 823 |
baseBondContribution: baseBondContribution.toFixed(2) + '%',
|
| 824 |
-
|
| 825 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 826 |
marketRef: `${marketRef.fixed_income_plus[period][0]}% - ${marketRef.fixed_income_plus[period][1]}%`,
|
| 827 |
hasCapitalGain: true
|
| 828 |
};
|
|
@@ -889,59 +890,46 @@
|
|
| 889 |
</div>
|
| 890 |
|
| 891 |
<div class="result-card">
|
| 892 |
-
<h3>📈 收益率分析</h3>
|
|
|
|
| 893 |
|
| 894 |
if (result.strategy === '纯债策略') {
|
| 895 |
html += `
|
| 896 |
-
<div class="contribution-breakdown">
|
| 897 |
<div class="contribution-item">
|
| 898 |
<span>基础收益率:</span>
|
| 899 |
<span>${result.baseReturn}</span>
|
| 900 |
</div>
|
| 901 |
<div class="contribution-item">
|
| 902 |
<span>资本利得贡献:</span>
|
| 903 |
-
<span>${result.capitalGainRange}</span>
|
| 904 |
-
</div>
|
| 905 |
-
<div class="contribution-item" style="margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ddd;">
|
| 906 |
-
<span><strong>理论预期收益率:</strong></span>
|
| 907 |
-
<span class="highlight"><strong>${result.totalReturn}</strong></span>
|
| 908 |
-
</div>
|
| 909 |
-
</div>
|
| 910 |
-
<div class="result-item" style="margin-top: 15px;">
|
| 911 |
-
<span>正收益概率:</span>
|
| 912 |
-
<span>${result.positiveProbability}</span>
|
| 913 |
-
</div>`;
|
| 914 |
} else {
|
| 915 |
html += `
|
| 916 |
-
<div class="contribution-breakdown">
|
| 917 |
<div class="contribution-item">
|
| 918 |
-
<span>
|
| 919 |
-
<span>${result.
|
| 920 |
</div>
|
| 921 |
<div class="contribution-item">
|
| 922 |
<span>资本利得贡献:</span>
|
| 923 |
-
<span>${result.
|
| 924 |
</div>
|
| 925 |
<div class="contribution-item">
|
| 926 |
<span>增强资产贡献:</span>
|
| 927 |
-
<span>${result.
|
| 928 |
-
<span class="range-indicator range-${result.expectationType.toLowerCase()}">
|
| 929 |
-
${result.assetReturnRange}
|
| 930 |
-
</span>
|
| 931 |
-
</span>
|
| 932 |
</div>
|
| 933 |
-
<div class="contribution-item" style="
|
| 934 |
-
<span>
|
| 935 |
-
<span
|
| 936 |
-
</div>
|
| 937 |
-
</div>
|
| 938 |
-
<div class="result-item" style="margin-top: 15px;">
|
| 939 |
-
<span>正收益概率:</span>
|
| 940 |
-
<span>${result.positiveProbability}</span>
|
| 941 |
-
</div>`;
|
| 942 |
}
|
| 943 |
|
| 944 |
html += `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 945 |
<div class="result-item" style="margin-top: 15px;">
|
| 946 |
<span>市场实际参考区间:</span>
|
| 947 |
<span>${result.marketRef}</span>
|
|
@@ -961,6 +949,7 @@
|
|
| 961 |
<p><strong>资产预期:</strong>${result.strategy === '固收+策略' ?
|
| 962 |
`采用${result.expectation}预期,${result.asset}指数预测区间为${result.assetReturnRange}` :
|
| 963 |
'纯债策略主要依赖票息收入和资本利得'}</p>
|
|
|
|
| 964 |
</div>`;
|
| 965 |
|
| 966 |
content.innerHTML = html;
|
|
|
|
| 291 |
background: #e8f5e9;
|
| 292 |
color: #2e7d32;
|
| 293 |
}
|
| 294 |
+
|
| 295 |
+
.bp-unit {
|
| 296 |
+
font-size: 0.85rem;
|
| 297 |
+
color: #666;
|
| 298 |
+
margin-left: 2px;
|
| 299 |
+
}
|
| 300 |
</style>
|
| 301 |
</head>
|
| 302 |
<body>
|
|
|
|
| 563 |
const p25 = normalQuantile(0.25, annualMean, annualStd);
|
| 564 |
const p75 = normalQuantile(0.75, annualMean, annualStd);
|
| 565 |
|
|
|
|
|
|
|
|
|
|
| 566 |
return {
|
| 567 |
lower: p25 / 100, // 转换为百分比
|
| 568 |
upper: p75 / 100,
|
| 569 |
mean: annualMean / 100,
|
| 570 |
+
std: annualStd / 100
|
|
|
|
| 571 |
};
|
| 572 |
}
|
| 573 |
|
|
|
|
| 639 |
// 资产预期收益率区间(使用您提供的数据)
|
| 640 |
const assetReturnRanges = {
|
| 641 |
'CONVERTIBLE_BOND': {
|
| 642 |
+
'PESSIMISTIC': { min: 5, max: 8 },
|
| 643 |
+
'NEUTRAL': { min: 8, max: 11 },
|
| 644 |
+
'OPTIMISTIC': { min: 11, max: 14 }
|
| 645 |
},
|
| 646 |
'EQUITY': {
|
| 647 |
+
'PESSIMISTIC': { min: 5, max: 10 },
|
| 648 |
+
'NEUTRAL': { min: 10, max: 15 },
|
| 649 |
+
'OPTIMISTIC': { min: 15, max: 20 }
|
| 650 |
},
|
| 651 |
'REITS': {
|
| 652 |
+
'PESSIMISTIC': { min: 4, max: 6 },
|
| 653 |
+
'NEUTRAL': { min: 6, max: 8 },
|
| 654 |
+
'OPTIMISTIC': { min: 8, max: 10 }
|
| 655 |
}
|
| 656 |
};
|
| 657 |
|
|
|
|
| 761 |
totalReturn: `${totalLower.toFixed(2)}% ~ ${totalUpper.toFixed(2)}%`,
|
| 762 |
totalLower: totalLower,
|
| 763 |
totalUpper: totalUpper,
|
|
|
|
| 764 |
marketRef: `${marketRef.pure_bond[period][0]}% - ${marketRef.pure_bond[period][1]}%`,
|
| 765 |
hasCapitalGain: true
|
| 766 |
};
|
|
|
|
| 771 |
const bondResult = calculateBaseReturn();
|
| 772 |
const capGain = calculateCapitalGainRange(period);
|
| 773 |
|
| 774 |
+
// 获取资产预期收益率区间
|
|
|
|
|
|
|
|
|
|
| 775 |
const assetRange = assetReturnRanges[asset][expectation];
|
|
|
|
| 776 |
|
| 777 |
// 配置比例
|
| 778 |
let bondWeight, assetWeight;
|
|
|
|
| 787 |
assetWeight = 20;
|
| 788 |
}
|
| 789 |
|
| 790 |
+
// 计算资本利得贡献(考虑债券权重)
|
| 791 |
+
const capitalGainLower = capGain.lower * bondWeight / 100;
|
| 792 |
+
const capitalGainUpper = capGain.upper * bondWeight / 100;
|
| 793 |
+
|
| 794 |
+
// 计算增强资产贡献区间(考虑资产权重)
|
| 795 |
+
const assetContributionLower = assetRange.min * assetWeight / 100;
|
| 796 |
+
const assetContributionUpper = assetRange.max * assetWeight / 100;
|
| 797 |
|
| 798 |
+
// 计算纯债基础部分贡献(考虑债券权重)
|
|
|
|
|
|
|
|
|
|
| 799 |
const baseBondContribution = bondResult.baseReturn * bondWeight / 100;
|
| 800 |
|
| 801 |
+
// 计算总收益率区间
|
| 802 |
+
// 下限:基础债券贡献 + 资本利得下限 + 资产贡献下限
|
| 803 |
+
const totalLower = baseBondContribution + capitalGainLower + assetContributionLower;
|
| 804 |
+
|
| 805 |
+
// 上限:基础债券贡献 + 资本利得上限 + 资产贡献上限
|
| 806 |
+
const totalUpper = baseBondContribution + capitalGainUpper + assetContributionUpper;
|
| 807 |
+
|
| 808 |
return {
|
| 809 |
strategy: '固收+策略',
|
| 810 |
period: state.getPeriodLabel(period),
|
|
|
|
| 815 |
bondWeight: bondWeight + '%',
|
| 816 |
assetWeight: assetWeight + '%',
|
| 817 |
baseBondReturn: bondResult.baseReturn.toFixed(2) + '%',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 818 |
baseBondContribution: baseBondContribution.toFixed(2) + '%',
|
| 819 |
+
capitalGainRange: `${(capGain.lower * 100).toFixed(2)}bp ~ ${(capGain.upper * 100).toFixed(2)}bp`,
|
| 820 |
+
capitalGainLower: capitalGainLower,
|
| 821 |
+
capitalGainUpper: capitalGainUpper,
|
| 822 |
+
assetReturnRange: `${assetRange.min}% ~ ${assetRange.max}%`,
|
| 823 |
+
assetContributionRange: `${assetContributionLower.toFixed(2)}% ~ ${assetContributionUpper.toFixed(2)}%`,
|
| 824 |
+
totalReturn: `${totalLower.toFixed(2)}% ~ ${totalUpper.toFixed(2)}%`,
|
| 825 |
+
totalLower: totalLower,
|
| 826 |
+
totalUpper: totalUpper,
|
| 827 |
marketRef: `${marketRef.fixed_income_plus[period][0]}% - ${marketRef.fixed_income_plus[period][1]}%`,
|
| 828 |
hasCapitalGain: true
|
| 829 |
};
|
|
|
|
| 890 |
</div>
|
| 891 |
|
| 892 |
<div class="result-card">
|
| 893 |
+
<h3>📈 收益率分析</h3>
|
| 894 |
+
<div class="contribution-breakdown">`;
|
| 895 |
|
| 896 |
if (result.strategy === '纯债策略') {
|
| 897 |
html += `
|
|
|
|
| 898 |
<div class="contribution-item">
|
| 899 |
<span>基础收益率:</span>
|
| 900 |
<span>${result.baseReturn}</span>
|
| 901 |
</div>
|
| 902 |
<div class="contribution-item">
|
| 903 |
<span>资本利得贡献:</span>
|
| 904 |
+
<span>${result.capitalGainRange}<span class="bp-unit">bp</span></span>
|
| 905 |
+
</div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 906 |
} else {
|
| 907 |
html += `
|
|
|
|
| 908 |
<div class="contribution-item">
|
| 909 |
+
<span>债券基础部分:</span>
|
| 910 |
+
<span>${result.baseBondContribution}</span>
|
| 911 |
</div>
|
| 912 |
<div class="contribution-item">
|
| 913 |
<span>资本利得贡献:</span>
|
| 914 |
+
<span>${result.capitalGainRange}<span class="bp-unit">bp</span></span>
|
| 915 |
</div>
|
| 916 |
<div class="contribution-item">
|
| 917 |
<span>增强资产贡献:</span>
|
| 918 |
+
<span>${result.assetContributionRange}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 919 |
</div>
|
| 920 |
+
<div class="contribution-item" style="font-size: 0.9rem; color: #666;">
|
| 921 |
+
<span>(资产预期收益率:</span>
|
| 922 |
+
<span>${result.assetReturnRange})</span>
|
| 923 |
+
</div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 924 |
}
|
| 925 |
|
| 926 |
html += `
|
| 927 |
+
<div class="contribution-item" style="margin-top: 10px; padding-top: 10px; border-top: 2px solid #ddd; font-weight: 600;">
|
| 928 |
+
<span>理论预期收益率:</span>
|
| 929 |
+
<span class="highlight">${result.totalReturn}</span>
|
| 930 |
+
</div>
|
| 931 |
+
</div>
|
| 932 |
+
|
| 933 |
<div class="result-item" style="margin-top: 15px;">
|
| 934 |
<span>市场实际参考区间:</span>
|
| 935 |
<span>${result.marketRef}</span>
|
|
|
|
| 949 |
<p><strong>资产预期:</strong>${result.strategy === '固收+策略' ?
|
| 950 |
`采用${result.expectation}预期,${result.asset}指数预测区间为${result.assetReturnRange}` :
|
| 951 |
'纯债策略主要依赖票息收入和资本利得'}</p>
|
| 952 |
+
<p><strong>最终收益率:</strong>基础收益率 + 资本利得区间 + 增强资产贡献区间(固收+策略)</p>
|
| 953 |
</div>`;
|
| 954 |
|
| 955 |
content.innerHTML = html;
|