Bondya commited on
Commit
bd5f654
·
verified ·
1 Parent(s): 3c9d3a6

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +812 -9
index.html CHANGED
@@ -1,17 +1,820 @@
1
  <!DOCTYPE html>
2
- <html>
3
  <head>
4
- <title>财顾报价通测试页</title>
 
 
 
5
  <style>
6
- body { font-family: Arial; padding: 40px; text-align: center; }
7
- h1 { color: #3498db; }
8
- .success { color: green; font-size: 24px; margin: 20px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  </style>
10
  </head>
11
  <body>
12
- <h1>🎉 财顾报价通测试页</h1>
13
- <div class="success">✅ 网页部署成功!</div>
14
- <p>如果看到此页面,说明Hugging Face Space工作正常。</p>
15
- <p>接下来可以将完整代码粘贴到这里替换本内容。</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  </body>
17
  </html>
 
1
  <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
  <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>财顾报价通 - 理财公司预期收益率报价系统</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
8
  <style>
9
+ :root {
10
+ --primary-color: #2c3e50;
11
+ --secondary-color: #3498db;
12
+ --success-color: #27ae60;
13
+ --warning-color: #f39c12;
14
+ --danger-color: #e74c3c;
15
+ --light-color: #ecf0f1;
16
+ --dark-color: #34495e;
17
+ }
18
+
19
+ * {
20
+ margin: 0;
21
+ padding: 0;
22
+ box-sizing: border-box;
23
+ }
24
+
25
+ body {
26
+ font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
27
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
28
+ color: #333;
29
+ line-height: 1.6;
30
+ min-height: 100vh;
31
+ }
32
+
33
+ .container {
34
+ max-width: 1200px;
35
+ margin: 0 auto;
36
+ padding: 20px;
37
+ }
38
+
39
+ header {
40
+ background: white;
41
+ padding: 20px;
42
+ border-radius: 10px;
43
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
44
+ margin-bottom: 30px;
45
+ text-align: center;
46
+ }
47
+
48
+ .logo {
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ gap: 15px;
53
+ margin-bottom: 10px;
54
+ }
55
+
56
+ .logo h1 {
57
+ color: var(--primary-color);
58
+ font-size: 2.2rem;
59
+ }
60
+
61
+ .subtitle {
62
+ color: var(--dark-color);
63
+ opacity: 0.8;
64
+ }
65
+
66
+ .calculator {
67
+ display: grid;
68
+ grid-template-columns: 1fr 1fr;
69
+ gap: 30px;
70
+ margin-bottom: 40px;
71
+ }
72
+
73
+ @media (max-width: 768px) {
74
+ .calculator {
75
+ grid-template-columns: 1fr;
76
+ }
77
+ }
78
+
79
+ .panel {
80
+ background: white;
81
+ padding: 25px;
82
+ border-radius: 10px;
83
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
84
+ }
85
+
86
+ .panel h2 {
87
+ color: var(--primary-color);
88
+ margin-bottom: 20px;
89
+ padding-bottom: 15px;
90
+ border-bottom: 2px solid var(--light-color);
91
+ display: flex;
92
+ align-items: center;
93
+ gap: 10px;
94
+ }
95
+
96
+ .form-group {
97
+ margin-bottom: 25px;
98
+ }
99
+
100
+ .form-group label {
101
+ display: block;
102
+ margin-bottom: 10px;
103
+ font-weight: 600;
104
+ color: var(--dark-color);
105
+ font-size: 1.1rem;
106
+ }
107
+
108
+ .button-group {
109
+ display: flex;
110
+ gap: 10px;
111
+ flex-wrap: wrap;
112
+ }
113
+
114
+ .btn {
115
+ padding: 12px 20px;
116
+ border: 2px solid #ddd;
117
+ background: white;
118
+ color: var(--dark-color);
119
+ border-radius: 6px;
120
+ cursor: pointer;
121
+ font-weight: 500;
122
+ transition: all 0.3s ease;
123
+ flex: 1;
124
+ min-width: 120px;
125
+ text-align: center;
126
+ }
127
+
128
+ .btn:hover {
129
+ border-color: var(--secondary-color);
130
+ color: var(--secondary-color);
131
+ }
132
+
133
+ .btn.active {
134
+ background: var(--secondary-color);
135
+ color: white;
136
+ border-color: var(--secondary-color);
137
+ }
138
+
139
+ .calculate-btn {
140
+ width: 100%;
141
+ padding: 16px;
142
+ background: linear-gradient(135deg, var(--secondary-color), #2980b9);
143
+ color: white;
144
+ border: none;
145
+ border-radius: 8px;
146
+ font-size: 1.1rem;
147
+ font-weight: 600;
148
+ cursor: pointer;
149
+ transition: all 0.3s ease;
150
+ margin-top: 10px;
151
+ }
152
+
153
+ .calculate-btn:hover {
154
+ transform: translateY(-2px);
155
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
156
+ }
157
+
158
+ .preview-item {
159
+ display: flex;
160
+ justify-content: space-between;
161
+ margin-bottom: 15px;
162
+ padding-bottom: 15px;
163
+ border-bottom: 1px solid var(--light-color);
164
+ }
165
+
166
+ .preview-label {
167
+ font-weight: 500;
168
+ }
169
+
170
+ .preview-value {
171
+ font-weight: 600;
172
+ color: var(--secondary-color);
173
+ }
174
+
175
+ .result-section {
176
+ background: white;
177
+ padding: 30px;
178
+ border-radius: 10px;
179
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
180
+ margin-top: 30px;
181
+ }
182
+
183
+ .result-grid {
184
+ display: grid;
185
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
186
+ gap: 25px;
187
+ margin: 25px 0;
188
+ }
189
+
190
+ .result-card {
191
+ background: #f8f9fa;
192
+ padding: 20px;
193
+ border-radius: 8px;
194
+ border-left: 4px solid var(--secondary-color);
195
+ }
196
+
197
+ .result-item {
198
+ display: flex;
199
+ justify-content: space-between;
200
+ margin-bottom: 12px;
201
+ }
202
+
203
+ .highlight {
204
+ color: var(--success-color);
205
+ font-weight: 600;
206
+ font-size: 1.2rem;
207
+ }
208
+
209
+ .loading {
210
+ text-align: center;
211
+ padding: 30px;
212
+ }
213
+
214
+ .spinner {
215
+ width: 40px;
216
+ height: 40px;
217
+ border: 4px solid #f3f3f3;
218
+ border-top: 4px solid var(--secondary-color);
219
+ border-radius: 50%;
220
+ animation: spin 1s linear infinite;
221
+ margin: 0 auto 15px;
222
+ }
223
+
224
+ @keyframes spin {
225
+ 0% { transform: rotate(0deg); }
226
+ 100% { transform: rotate(360deg); }
227
+ }
228
+
229
+ .hidden {
230
+ display: none;
231
+ }
232
+
233
+ .feature-list {
234
+ list-style: none;
235
+ padding-left: 0;
236
+ }
237
+
238
+ .feature-list li {
239
+ padding: 8px 0;
240
+ display: flex;
241
+ align-items: center;
242
+ gap: 10px;
243
+ }
244
+
245
+ .feature-list li i {
246
+ color: var(--success-color);
247
+ }
248
+
249
+ footer {
250
+ text-align: center;
251
+ margin-top: 40px;
252
+ padding-top: 20px;
253
+ border-top: 1px solid #ddd;
254
+ color: #666;
255
+ font-size: 0.9rem;
256
+ }
257
  </style>
258
  </head>
259
  <body>
260
+ <div class="container">
261
+ <header>
262
+ <div class="logo">
263
+ <h1>财顾报价通</h1>
264
+ </div>
265
+ <p class="subtitle">理财公司预期收益率报价系统</p>
266
+ </header>
267
+
268
+ <div class="calculator">
269
+ <div class="panel">
270
+ <h2>⚙️ 参数设置</h2>
271
+
272
+ <div class="form-group">
273
+ <label>策略类型</label>
274
+ <div class="button-group">
275
+ <button class="btn active" data-type="strategy" data-value="PURE_BOND">纯债策略</button>
276
+ <button class="btn" data-type="strategy" data-value="FIXED_INCOME_PLUS">固收+策略</button>
277
+ </div>
278
+ </div>
279
+
280
+ <div class="form-group">
281
+ <label>投资期限</label>
282
+ <div class="button-group">
283
+ <button class="btn active" data-type="period" data-value="SHORT">短期(0-3个月)</button>
284
+ <button class="btn" data-type="period" data-value="MEDIUM">中期(3-6个月)</button>
285
+ <button class="btn" data-type="period" data-value="LONG">长期(6-12个月)</button>
286
+ </div>
287
+ </div>
288
+
289
+ <div class="form-group">
290
+ <label>风险风格</label>
291
+ <div class="button-group">
292
+ <button class="btn active" data-type="risk" data-value="CONSERVATIVE">保守型</button>
293
+ <button class="btn" data-type="risk" data-value="NEUTRAL">中性型</button>
294
+ <button class="btn" data-type="risk" data-value="AGGRESSIVE">激进型</button>
295
+ </div>
296
+ </div>
297
+
298
+ <div id="plus-section" class="form-group hidden">
299
+ <label>增强资产类别</label>
300
+ <div class="button-group">
301
+ <button class="btn" data-type="asset" data-value="CONVERTIBLE_BOND">转债</button>
302
+ <button class="btn" data-type="asset" data-value="EQUITY">权益</button>
303
+ <button class="btn" data-type="asset" data-value="REITS">REITs</button>
304
+ </div>
305
+
306
+ <label style="margin-top: 20px; display: block;">资产预期</label>
307
+ <div class="button-group">
308
+ <button class="btn" data-type="expectation" data-value="PESSIMISTIC">悲观</button>
309
+ <button class="btn active" data-type="expectation" data-value="NEUTRAL">中性</button>
310
+ <button class="btn" data-type="expectation" data-value="OPTIMISTIC">乐观</button>
311
+ </div>
312
+ </div>
313
+
314
+ <button id="calculate" class="calculate-btn">🚀 计算预期收益率</button>
315
+ </div>
316
+
317
+ <div class="panel">
318
+ <h2>👁️ 参数预览</h2>
319
+ <div id="preview">
320
+ <div class="preview-item">
321
+ <span class="preview-label">策略类型:</span>
322
+ <span id="preview-strategy" class="preview-value">纯债策略</span>
323
+ </div>
324
+ <div class="preview-item">
325
+ <span class="preview-label">投资期限:</span>
326
+ <span id="preview-period" class="preview-value">短期(0-3个月)</span>
327
+ </div>
328
+ <div class="preview-item">
329
+ <span class="preview-label">风险风格:</span>
330
+ <span id="preview-risk" class="preview-value">保守型</span>
331
+ </div>
332
+ <div class="preview-item hidden" id="preview-asset-item">
333
+ <span class="preview-label">增强资产:</span>
334
+ <span id="preview-asset" class="preview-value">-</span>
335
+ </div>
336
+ <div class="preview-item hidden" id="preview-expectation-item">
337
+ <span class="preview-label">资产预期:</span>
338
+ <span id="preview-expectation" class="preview-value">-</span>
339
+ </div>
340
+ </div>
341
+
342
+ <h2 style="margin-top: 30px;">✨ 系统特点</h2>
343
+ <ul class="feature-list">
344
+ <li><i>✓</i> 基于量化模型计算</li>
345
+ <li><i>✓</i> 考虑资本利得概率分布</li>
346
+ <li><i>✓</i> 提供市场实际参考区间</li>
347
+ <li><i>✓</i> 支持纯债/固收+策略</li>
348
+ <li><i>✓</i> 纯前端计算,保护隐私</li>
349
+ </ul>
350
+ </div>
351
+ </div>
352
+
353
+ <div id="loading" class="loading hidden">
354
+ <div class="spinner"></div>
355
+ <p>正在计算预期收益率...</p>
356
+ </div>
357
+
358
+ <div id="result" class="result-section hidden">
359
+ <h2>📊 报价结果详情</h2>
360
+ <div id="result-content"></div>
361
+ </div>
362
+
363
+ <footer>
364
+ <p>© 2024 财顾报价通 | 仅供演示使用 | 计算结果仅供参考,不构成投资建议</p>
365
+ </footer>
366
+ </div>
367
+
368
+ <script>
369
+ // 全局状态
370
+ const state = {
371
+ strategy: 'PURE_BOND',
372
+ period: 'SHORT',
373
+ risk: 'CONSERVATIVE',
374
+ asset: 'CONVERTIBLE_BOND',
375
+ expectation: 'NEUTRAL',
376
+
377
+ updatePreview() {
378
+ // 更新预览显示
379
+ document.getElementById('preview-strategy').textContent =
380
+ this.strategy === 'PURE_BOND' ? '纯债策略' : '固收+策略';
381
+ document.getElementById('preview-period').textContent =
382
+ this.getPeriodLabel(this.period);
383
+ document.getElementById('preview-risk').textContent =
384
+ this.getRiskLabel(this.risk);
385
+
386
+ // 显示/隐藏固收+相关预览
387
+ const plusSection = document.getElementById('plus-section');
388
+ const assetPreview = document.getElementById('preview-asset-item');
389
+ const expectationPreview = document.getElementById('preview-expectation-item');
390
+
391
+ if (this.strategy === 'FIXED_INCOME_PLUS') {
392
+ plusSection.classList.remove('hidden');
393
+ assetPreview.classList.remove('hidden');
394
+ expectationPreview.classList.remove('hidden');
395
+
396
+ document.getElementById('preview-asset').textContent =
397
+ this.getAssetLabel(this.asset);
398
+ document.getElementById('preview-expectation').textContent =
399
+ this.getExpectationLabel(this.expectation);
400
+ } else {
401
+ plusSection.classList.add('hidden');
402
+ assetPreview.classList.add('hidden');
403
+ expectationPreview.classList.add('hidden');
404
+ }
405
+ },
406
+
407
+ getPeriodLabel(value) {
408
+ const labels = {
409
+ 'SHORT': '短期(0-3个月)',
410
+ 'MEDIUM': '中期(3-6个月)',
411
+ 'LONG': '长期(6-12个月)'
412
+ };
413
+ return labels[value];
414
+ },
415
+
416
+ getRiskLabel(value) {
417
+ const labels = {
418
+ 'CONSERVATIVE': '保守型',
419
+ 'NEUTRAL': '中性型',
420
+ 'AGGRESSIVE': '激进型'
421
+ };
422
+ return labels[value];
423
+ },
424
+
425
+ getAssetLabel(value) {
426
+ const labels = {
427
+ 'CONVERTIBLE_BOND': '转债',
428
+ 'EQUITY': '权益',
429
+ 'REITS': 'REITs'
430
+ };
431
+ return labels[value];
432
+ },
433
+
434
+ getExpectationLabel(value) {
435
+ const labels = {
436
+ 'PESSIMISTIC': '悲观',
437
+ 'NEUTRAL': '中性',
438
+ 'OPTIMISTIC': '乐观'
439
+ };
440
+ return labels[value];
441
+ }
442
+ };
443
+
444
+ // 初始化
445
+ document.addEventListener('DOMContentLoaded', function() {
446
+ // 按钮点击事件
447
+ document.querySelectorAll('.btn').forEach(btn => {
448
+ btn.addEventListener('click', function() {
449
+ const type = this.dataset.type;
450
+ const value = this.dataset.value;
451
+
452
+ // 移除同类型按钮的active类
453
+ document.querySelectorAll(`.btn[data-type="${type}"]`).forEach(b => {
454
+ b.classList.remove('active');
455
+ });
456
+
457
+ // 为当前按钮添加active类
458
+ this.classList.add('active');
459
+
460
+ // 更新状态
461
+ state[type] = value;
462
+ state.updatePreview();
463
+ });
464
+ });
465
+
466
+ // 计算按钮事件
467
+ document.getElementById('calculate').addEventListener('click', calculateQuotation);
468
+ });
469
+
470
+ // 计算核心函数
471
+ function calculateQuotation() {
472
+ // 显示加载动画
473
+ document.getElementById('loading').classList.remove('hidden');
474
+ document.getElementById('result').classList.add('hidden');
475
+
476
+ // 模拟计算延迟
477
+ setTimeout(() => {
478
+ try {
479
+ const result = performCalculation();
480
+ displayResults(result);
481
+ } catch (error) {
482
+ alert('计算错误: ' + error.message);
483
+ } finally {
484
+ document.getElementById('loading').classList.add('hidden');
485
+ }
486
+ }, 800);
487
+ }
488
+
489
+ // 核心计算逻辑
490
+ function performCalculation() {
491
+ const { strategy, period, risk, asset, expectation } = state;
492
+
493
+ // 默认收益率数据
494
+ const defaultReturns = {
495
+ // 短期资产
496
+ "7d_notice_deposit": 1.2,
497
+ "3m_state_ncd": 2.0,
498
+ "overnight_rate": 1.5,
499
+
500
+ // 中期资产
501
+ "gov_bond_under_1y": 2.1,
502
+ "gov_bond_under_2y": 2.3,
503
+ "gov_bond_under_3y": 2.5,
504
+ "gov_bond_under_5y": 2.8,
505
+
506
+ // 同业存单
507
+ "ncd_1y_state": 2.2,
508
+ "ncd_1y_aaa": 2.4,
509
+ "ncd_1y_aa": 2.8,
510
+
511
+ // 信用债
512
+ "credit_1y_aaa_plus": 2.3,
513
+ "credit_1y_aaa": 2.6,
514
+ "credit_1y_aa": 3.2,
515
+ "credit_2y_aaa_plus": 2.5,
516
+ "credit_2y_aaa": 2.8,
517
+ "credit_2y_aa": 3.5,
518
+ };
519
+
520
+ // 市场参考数据(按您提供的数据)
521
+ const marketRef = {
522
+ pure_bond: {
523
+ 'SHORT': [1.24, 1.40],
524
+ 'MEDIUM': [1.74, 3.00],
525
+ 'LONG': [2.05, 3.24]
526
+ },
527
+ fixed_income_plus: {
528
+ 'SHORT': [1.24, 1.60],
529
+ 'MEDIUM': [1.84, 2.94],
530
+ 'LONG': [2.18, 3.03]
531
+ }
532
+ };
533
+
534
+ // 资本利得计算(简化版)
535
+ function calculateCapitalGain() {
536
+ // 模拟正态分布
537
+ const mean = 0.03; // 平均3bp/次
538
+ const std = 0.04; // 标准差4bp/次
539
+ const cycles = 3; // 年波动次数
540
+
541
+ // 计算年化分布参数
542
+ const annualMean = mean * cycles;
543
+ const annualStd = std * Math.sqrt(cycles);
544
+
545
+ // 计算80%置信区间
546
+ const z80 = 1.28; // 80%置信度的Z值
547
+ const lower80 = annualMean - z80 * annualStd;
548
+ const upper80 = annualMean + z80 * annualStd;
549
+
550
+ return {
551
+ lower: lower80,
552
+ upper: upper80,
553
+ probability: 65 // 正收益概率65%
554
+ };
555
+ }
556
+
557
+ // 纯债策略计算
558
+ if (strategy === 'PURE_BOND') {
559
+ // 根据期限和风险风格计算基础收益率
560
+ let baseReturn = 0;
561
+ let leverage = 100;
562
+
563
+ if (period === 'SHORT') {
564
+ if (risk === 'CONSERVATIVE') {
565
+ baseReturn = defaultReturns['7d_notice_deposit'] * 0.5 +
566
+ defaultReturns['3m_state_ncd'] * 0.1 +
567
+ defaultReturns['overnight_rate'] * 0.4;
568
+ } else if (risk === 'NEUTRAL') {
569
+ baseReturn = defaultReturns['7d_notice_deposit'] * 0.5 +
570
+ defaultReturns['3m_state_ncd'] * 0.25 +
571
+ defaultReturns['overnight_rate'] * 0.25;
572
+ } else { // AGGRESSIVE
573
+ baseReturn = defaultReturns['7d_notice_deposit'] * 0.4 +
574
+ defaultReturns['3m_state_ncd'] * 0.4 +
575
+ defaultReturns['overnight_rate'] * 0.2;
576
+ }
577
+ } else if (period === 'MEDIUM') {
578
+ if (risk === 'CONSERVATIVE') {
579
+ baseReturn = defaultReturns['gov_bond_under_1y'] * 0.5 +
580
+ defaultReturns['ncd_1y_state'] * 0.4 +
581
+ defaultReturns['credit_1y_aaa_plus'] * 0.1;
582
+ leverage = 100;
583
+ } else if (risk === 'NEUTRAL') {
584
+ baseReturn = defaultReturns['gov_bond_under_1y'] * 0.3 +
585
+ defaultReturns['ncd_1y_aaa'] * 0.4 +
586
+ defaultReturns['credit_1y_aaa'] * 0.3;
587
+ leverage = 110;
588
+ } else { // AGGRESSIVE
589
+ baseReturn = defaultReturns['gov_bond_under_1y'] * 0.3 +
590
+ defaultReturns['ncd_1y_aa'] * 0.3 +
591
+ defaultReturns['credit_1y_aa'] * 0.4;
592
+ leverage = 120;
593
+ }
594
+ } else { // LONG
595
+ if (risk === 'CONSERVATIVE') {
596
+ baseReturn = defaultReturns['gov_bond_under_2y'] * 0.5 +
597
+ defaultReturns['ncd_1y_state'] * 0.4 +
598
+ defaultReturns['credit_2y_aaa_plus'] * 0.1;
599
+ leverage = 100;
600
+ } else if (risk === 'NEUTRAL') {
601
+ baseReturn = defaultReturns['gov_bond_under_3y'] * 0.3 +
602
+ defaultReturns['ncd_1y_aaa'] * 0.4 +
603
+ defaultReturns['credit_2y_aaa'] * 0.3;
604
+ leverage = 110;
605
+ } else { // AGGRESSIVE
606
+ baseReturn = defaultReturns['gov_bond_under_5y'] * 0.3 +
607
+ defaultReturns['ncd_1y_aa'] * 0.3 +
608
+ defaultReturns['credit_2y_aa'] * 0.4;
609
+ leverage = 120;
610
+ }
611
+ }
612
+
613
+ // 杠杆计算
614
+ const fundingCost = defaultReturns['overnight_rate'];
615
+ let leveredReturn = baseReturn;
616
+
617
+ if (leverage > 100) {
618
+ const L = leverage / 100;
619
+ leveredReturn = L * baseReturn - (L - 1) * fundingCost;
620
+ }
621
+
622
+ // 计算资本利得
623
+ const capGain = calculateCapitalGain();
624
+ const totalLower = leveredReturn + capGain.lower;
625
+ const totalUpper = leveredReturn + capGain.upper;
626
+
627
+ return {
628
+ strategy: '纯债策略',
629
+ period: state.getPeriodLabel(period),
630
+ risk: state.getRiskLabel(risk),
631
+ leverage: leverage + '%',
632
+ fundingCost: fundingCost + '%',
633
+ baseReturn: leveredReturn.toFixed(2) + '%',
634
+ capitalGainRange: `${(capGain.lower * 100).toFixed(1)}bp ~ ${(capGain.upper * 100).toFixed(1)}bp`,
635
+ totalReturn: `${totalLower.toFixed(2)}% ~ ${totalUpper.toFixed(2)}%`,
636
+ positiveProbability: capGain.probability + '%',
637
+ marketRef: `${marketRef.pure_bond[period][0]}% - ${marketRef.pure_bond[period][1]}%`
638
+ };
639
+ }
640
+ // 固收+策略计算
641
+ else {
642
+ // 先计算纯债部分
643
+ let pureBondReturn = 0;
644
+
645
+ // 简化计算,使用固定值
646
+ if (period === 'SHORT') pureBondReturn = 1.5;
647
+ else if (period === 'MEDIUM') pureBondReturn = 2.4;
648
+ else pureBondReturn = 2.8;
649
+
650
+ // 加上资本利得(取乐观��景)
651
+ const capGain = calculateCapitalGain();
652
+ pureBondReturn += capGain.upper;
653
+
654
+ // 资产预期收益率
655
+ const assetReturns = {
656
+ 'CONVERTIBLE_BOND': { 'PESSIMISTIC': 10.0, 'NEUTRAL': 12.5, 'OPTIMISTIC': 15.0 },
657
+ 'EQUITY': { 'PESSIMISTIC': 15.0, 'NEUTRAL': 17.5, 'OPTIMISTIC': 20.0 },
658
+ 'REITS': { 'PESSIMISTIC': 5.0, 'NEUTRAL': 7.5, 'OPTIMISTIC': 10.0 }
659
+ };
660
+
661
+ const assetReturn = assetReturns[asset][expectation];
662
+
663
+ // 配置比例
664
+ let bondWeight, assetWeight;
665
+ if (expectation === 'PESSIMISTIC') {
666
+ bondWeight = 95;
667
+ assetWeight = 5;
668
+ } else if (expectation === 'NEUTRAL') {
669
+ bondWeight = 90;
670
+ assetWeight = 10;
671
+ } else { // OPTIMISTIC
672
+ bondWeight = 80;
673
+ assetWeight = 20;
674
+ }
675
+
676
+ // 计算总收益率
677
+ const totalReturn = (pureBondReturn * bondWeight + assetReturn * assetWeight) / 100;
678
+
679
+ return {
680
+ strategy: '固收+策略',
681
+ period: state.getPeriodLabel(period),
682
+ risk: state.getRiskLabel(risk),
683
+ asset: state.getAssetLabel(asset),
684
+ expectation: state.getExpectationLabel(expectation),
685
+ bondWeight: bondWeight + '%',
686
+ assetWeight: assetWeight + '%',
687
+ pureBondReturn: pureBondReturn.toFixed(2) + '%',
688
+ assetReturn: assetReturn.toFixed(1) + '%',
689
+ totalReturn: totalReturn.toFixed(2) + '%',
690
+ capitalGain: (capGain.upper * 100).toFixed(1) + 'bp',
691
+ positiveProbability: capGain.probability + '%',
692
+ marketRef: `${marketRef.fixed_income_plus[period][0]}% - ${marketRef.fixed_income_plus[period][1]}%`
693
+ };
694
+ }
695
+ }
696
+
697
+ // 显示结果
698
+ function displayResults(result) {
699
+ const content = document.getElementById('result-content');
700
+
701
+ let html = `
702
+ <div class="result-grid">
703
+ <div class="result-card">
704
+ <h3>📋 基本信息</h3>
705
+ <div class="result-item">
706
+ <span>策略类型:</span>
707
+ <span class="highlight">${result.strategy}</span>
708
+ </div>
709
+ <div class="result-item">
710
+ <span>投资期限:</span>
711
+ <span>${result.period}</span>
712
+ </div>
713
+ <div class="result-item">
714
+ <span>风险风格:</span>
715
+ <span>${result.risk}</span>
716
+ </div>`;
717
+
718
+ if (result.strategy === '纯债策略') {
719
+ html += `
720
+ <div class="result-item">
721
+ <span>杠杆率:</span>
722
+ <span>${result.leverage}</span>
723
+ </div>
724
+ <div class="result-item">
725
+ <span>融资成本:</span>
726
+ <span>${result.fundingCost}</span>
727
+ </div>`;
728
+ } else {
729
+ html += `
730
+ <div class="result-item">
731
+ <span>增强资产:</span>
732
+ <span>${result.asset}</span>
733
+ </div>
734
+ <div class="result-item">
735
+ <span>资产预期:</span>
736
+ <span>${result.expectation}</span>
737
+ </div>
738
+ <div class="result-item">
739
+ <span>债券比例:</span>
740
+ <span>${result.bondWeight}</span>
741
+ </div>
742
+ <div class="result-item">
743
+ <span>资产比例:</span>
744
+ <span>${result.assetWeight}</span>
745
+ </div>`;
746
+ }
747
+
748
+ html += `
749
+ </div>
750
+
751
+ <div class="result-card">
752
+ <h3>📈 收益率分析</h3>`;
753
+
754
+ if (result.strategy === '纯债策略') {
755
+ html += `
756
+ <div class="result-item">
757
+ <span>基础收益率:</span>
758
+ <span>${result.baseReturn}</span>
759
+ </div>
760
+ <div class="result-item">
761
+ <span>资本利得贡献:</span>
762
+ <span>${result.capitalGainRange}</span>
763
+ </div>
764
+ <div class="result-item">
765
+ <span>理论预期收益率:</span>
766
+ <span class="highlight">${result.totalReturn}</span>
767
+ </div>
768
+ <div class="result-item">
769
+ <span>正收益概率:</span>
770
+ <span>${result.positiveProbability}</span>
771
+ </div>`;
772
+ } else {
773
+ html += `
774
+ <div class="result-item">
775
+ <span>纯债部分收益率:</span>
776
+ <span>${result.pureBondReturn}</span>
777
+ </div>
778
+ <div class="result-item">
779
+ <span>资本利得贡献:</span>
780
+ <span>${result.capitalGain}</span>
781
+ </div>
782
+ <div class="result-item">
783
+ <span>资产预期收益率:</span>
784
+ <span>${result.assetReturn}</span>
785
+ </div>
786
+ <div class="result-item">
787
+ <span>理论预期收益率:</span>
788
+ <span class="highlight">${result.totalReturn}</span>
789
+ </div>
790
+ <div class="result-item">
791
+ <span>正收益概率:</span>
792
+ <span>${result.positiveProbability}</span>
793
+ </div>`;
794
+ }
795
+
796
+ html += `
797
+ <div class="result-item">
798
+ <span>市场实际参考区间:</span>
799
+ <span>${result.marketRef}</span>
800
+ </div>
801
+ </div>
802
+ </div>
803
+
804
+ <div style="margin-top: 30px; padding: 20px; background: #f0f8ff; border-radius: 8px;">
805
+ <h3>💡 使用说明</h3>
806
+ <p>1. 以上计算结果基于预设的量化模型和市场数据</p>
807
+ <p>2. 资本利得考虑了交易员的波段操作能力和市场波动</p>
808
+ <p>3. 市场参考区间基于近期实际理财收益率数据</p>
809
+ <p>4. 计算结果仅供参考,实际收益可能受多种因素影响</p>
810
+ </div>`;
811
+
812
+ content.innerHTML = html;
813
+ document.getElementById('result').classList.remove('hidden');
814
+
815
+ // 滚动到结果区域
816
+ document.getElementById('result').scrollIntoView({ behavior: 'smooth' });
817
+ }
818
+ </script>
819
  </body>
820
  </html>