forked from quantopian/pyfolio
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcurrent_page.html
More file actions
530 lines (505 loc) · 15.8 KB
/
current_page.html
File metadata and controls
530 lines (505 loc) · 15.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pyfolio - 策略绩效分析</title>
<link rel="stylesheet" href="/static/style.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body>
<nav class="navbar">
<div class="nav-container">
<div class="nav-brand">
<i class="fas fa-chart-line"></i>
<span>PyFolio Analytics</span>
</div>
<div class="nav-time">
<i class="far fa-clock"></i>
<span id="current-time"></span>
</div>
</div>
</nav>
<header class="hero">
<h1 class="hero-title">Pyfolio - 策略绩效分析</h1>
<p class="hero-subtitle">专业的量化投资策略分析报告</p>
</header>
<main class="container">
<!-- 性能指标卡片 -->
<section class="metrics-section">
<h2 class="section-title">
<i class="fas fa-tachometer-alt"></i>
关键性能指标
</h2>
<div class="metrics-grid">
<div class="metric-card">
<div class="metric-icon blue">
<i class="fas fa-chart-line"></i>
</div>
<div class="metric-content">
<h3>收益分析</h3>
<p>策略表现与基准对比</p>
</div>
</div>
<div class="metric-card">
<div class="metric-icon green">
<i class="fas fa-shield-alt"></i>
</div>
<div class="metric-content">
<h3>风险评估</h3>
<p>压力测试与极端事件</p>
</div>
</div>
<div class="metric-card">
<div class="metric-icon purple">
<i class="fas fa-briefcase"></i>
</div>
<div class="metric-content">
<h3>持仓分析</h3>
<p>多空头寸详细分解</p>
</div>
</div>
</div>
</section>
<!-- 收益分析部分 -->
<section class="analysis-section">
<div class="section-header">
<h2 class="section-title">
<i class="fas fa-chart-area"></i>
收益表现分析
</h2>
<div class="section-actions">
<button class="btn-icon" onclick="toggleSection('returns-content')">
<i class="fas fa-chevron-down"></i>
</button>
</div>
</div>
<div id="returns-content" class="section-content">
<div class="analysis-row">
<div class="table-panel">
<h3 class="panel-title">性能统计</h3>
<div class="table-wrapper">
<table border="1" class="dataframe data">
<thead>
<tr style="text-align: right;">
<th>performance analysis</th>
<th>In-sample</th>
<th>Out-of-sample</th>
<th>All</th>
</tr>
</thead>
<tbody>
<tr>
<td>Annual return</td>
<td>14.5%</td>
<td>32.8%</td>
<td>19.7%</td>
</tr>
<tr>
<td>Cumulative returns</td>
<td>125.3%</td>
<td>109.4%</td>
<td>371.7%</td>
</tr>
<tr>
<td>Annual volatility</td>
<td>12.1%</td>
<td>11.9%</td>
<td>12.0%</td>
</tr>
<tr>
<td>Sharpe ratio</td>
<td>1.177243</td>
<td>2.446648</td>
<td>1.555593</td>
</tr>
<tr>
<td>Calmar ratio</td>
<td>1.079673</td>
<td>5.389994</td>
<td>1.473072</td>
</tr>
<tr>
<td>Stability</td>
<td>0.956281</td>
<td>0.989377</td>
<td>0.967075</td>
</tr>
<tr>
<td>Max drawdown</td>
<td>-13.4%</td>
<td>-6.1%</td>
<td>-13.4%</td>
</tr>
<tr>
<td>Omega ratio</td>
<td>1.414976</td>
<td>1.954344</td>
<td>1.564826</td>
</tr>
<tr>
<td>Sortino ratio</td>
<td>1.73162</td>
<td>4.404958</td>
<td>2.410434</td>
</tr>
<tr>
<td>Skew</td>
<td>-1.086068</td>
<td>1.412214</td>
<td>-0.358709</td>
</tr>
<tr>
<td>Kurtosis</td>
<td>25.754651</td>
<td>17.177968</td>
<td>23.392094</td>
</tr>
<tr>
<td>Tail ratio</td>
<td>1.641023</td>
<td>1.716636</td>
<td>1.597652</td>
</tr>
<tr>
<td>Daily value at risk</td>
<td>-1.5%</td>
<td>-1.4%</td>
<td>-1.4%</td>
</tr>
<tr>
<td>Gross leverage</td>
<td>0.352323</td>
<td>0.386828</td>
<td>0.362739</td>
</tr>
<tr>
<td>Alpha</td>
<td>0.141727</td>
<td>0.317675</td>
<td>0.19232</td>
</tr>
<tr>
<td>Beta</td>
<td>0.045277</td>
<td>0.047305</td>
<td>0.045815</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="chart-panel">
<h3 class="panel-title">收益走势图</h3>
<div class="chart-wrapper">
<img src="/static/image/returns_tear_sheet.png" alt="Returns Analysis" class="chart-image">
</div>
</div>
</div>
</div>
</section>
<!-- 压力测试部分 -->
<section class="analysis-section">
<div class="section-header">
<h2 class="section-title">
<i class="fas fa-exclamation-triangle"></i>
压力测试与极端事件
</h2>
<div class="section-actions">
<button class="btn-icon" onclick="toggleSection('stress-content')">
<i class="fas fa-chevron-down"></i>
</button>
</div>
</div>
<div id="stress-content" class="section-content">
<div class="analysis-row">
<div class="table-panel">
<h3 class="panel-title">极端事件表现</h3>
<div class="table-wrapper">
<table border="1" class="dataframe data">
<thead>
<tr style="text-align: right;">
<th>Stress Events</th>
<th>mean</th>
<th>min</th>
<th>max</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apr14</td>
<td>0.063258</td>
<td>-0.048156</td>
<td>1.396299</td>
</tr>
<tr>
<td>Oct14</td>
<td>0.198627</td>
<td>-0.573306</td>
<td>1.968026</td>
</tr>
<tr>
<td>Fall2015</td>
<td>0.137593</td>
<td>-2.250820</td>
<td>3.647507</td>
</tr>
<tr>
<td>Recovery</td>
<td>0.222193</td>
<td>-1.076031</td>
<td>3.465246</td>
</tr>
<tr>
<td>New Normal</td>
<td>0.070267</td>
<td>-9.652991</td>
<td>7.228968</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="chart-panel">
<h3 class="panel-title">特殊时期分析</h3>
<div class="chart-wrapper">
<img src="/static/image/interesting_times_tear_sheet.png" alt="Stress Events Analysis" class="chart-image">
</div>
</div>
</div>
</div>
</section>
<!-- 持仓分析部分 -->
<section class="analysis-section">
<div class="section-header">
<h2 class="section-title">
<i class="fas fa-coins"></i>
持仓分析
</h2>
<div class="section-actions">
<button class="btn-icon" onclick="toggleSection('position-content')">
<i class="fas fa-chevron-down"></i>
</button>
</div>
</div>
<div id="position-content" class="section-content">
<div class="analysis-row">
<div class="table-panel">
<div class="position-tables">
<div class="position-table-group">
<h3 class="panel-title">
<i class="fas fa-arrow-up text-success"></i>
多头持仓 TOP 10
</h3>
<div class="table-wrapper">
<table border="1" class="dataframe data">
<thead>
<tr style="text-align: right;">
<th>Top 10 long positions of all time</th>
<th>max</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data0</td>
<td>99.994008</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="position-table-group">
<h3 class="panel-title">
<i class="fas fa-arrow-down text-danger"></i>
空头持仓 TOP 10
</h3>
<div class="table-wrapper">
<table border="1" class="dataframe data">
<thead>
<tr style="text-align: right;">
<th>Top 10 short positions of all time</th>
<th>max</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="chart-panel">
<h3 class="panel-title">持仓分布图</h3>
<div class="chart-wrapper">
<img src="/static/image/position_tear_sheet.png" alt="Position Analysis" class="chart-image">
</div>
</div>
</div>
</div>
</section>
<!-- 其他统计部分 -->
<section class="analysis-section">
<div class="section-header">
<h2 class="section-title">
<i class="fas fa-database"></i>
其他统计数据
</h2>
<div class="section-actions">
<button class="btn-icon" onclick="toggleSection('other-content')">
<i class="fas fa-chevron-down"></i>
</button>
</div>
</div>
<div id="other-content" class="section-content">
<div class="stats-grid">
<div class="stats-card">
<h3 class="panel-title">
<i class="fas fa-chart-bar"></i>
最大回撤期
</h3>
<div class="table-wrapper">
<table border="1" class="dataframe data">
<thead>
<tr style="text-align: right;">
<th>Worst drawdown periods</th>
<th>Net drawdown in %</th>
<th>Peak date</th>
<th>Valley date</th>
<th>Recovery date</th>
<th>Duration</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>13.386068</td>
<td>2015-07-23</td>
<td>2015-07-28</td>
<td>2015-10-12</td>
<td>58</td>
</tr>
<tr>
<td>1</td>
<td>10.328004</td>
<td>2013-03-22</td>
<td>2014-03-28</td>
<td>2014-08-19</td>
<td>368</td>
</tr>
<tr>
<td>2</td>
<td>9.738382</td>
<td>2015-10-12</td>
<td>2015-12-08</td>
<td>2016-02-17</td>
<td>93</td>
</tr>
<tr>
<td>3</td>
<td>6.691605</td>
<td>2015-07-13</td>
<td>2015-07-15</td>
<td>2015-07-23</td>
<td>9</td>
</tr>
<tr>
<td>4</td>
<td>6.091674</td>
<td>2020-07-13</td>
<td>2020-09-17</td>
<td>2020-11-09</td>
<td>86</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="stats-card">
<h3 class="panel-title">
<i class="fas fa-list-ol"></i>
历史持仓 TOP 10
</h3>
<div class="table-wrapper">
<table border="1" class="dataframe data">
<thead>
<tr style="text-align: right;">
<th>Top 10 positions of all time</th>
<th>max</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data0</td>
<td>99.994008</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="stats-card">
<h3 class="panel-title">
<i class="fas fa-calendar-alt"></i>
月度统计
</h3>
<div class="table-wrapper">
<table border="1" class="dataframe data">
<thead>
<tr style="text-align: right;">
<th>total months</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="footer">
<div class="footer-content">
<p>© 2025 PyFolio Analytics. Powered by CloudQuant Technology.</p>
</div>
</footer>
<script>
// 显示当前时间
function updateTime() {
const now = new Date();
const timeString = now.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
document.getElementById('current-time').textContent = timeString;
}
updateTime();
setInterval(updateTime, 1000);
// 切换部分显示/隐藏
function toggleSection(sectionId) {
const section = document.getElementById(sectionId);
const button = section.previousElementSibling.querySelector('.btn-icon i');
if (section.style.display === 'none') {
section.style.display = 'block';
button.className = 'fas fa-chevron-down';
} else {
section.style.display = 'none';
button.className = 'fas fa-chevron-right';
}
}
// 平滑滚动
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
</script>
</body>
</html>