File size: 27,024 Bytes
cc5978c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Analytics - QuantumTrade Nexus</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.min.js"></script>
    <script>
        tailwind.config = {
            darkMode: 'class',
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#f0f9ff',
                            100: '#e0f2fe',
                            200: '#bae6fd',
                            300: '#7dd3fc',
                            400: '#38bdf8',
                            500: '#0ea5e9',
                            600: '#0284c7',
                            700: '#0369a1',
                            800: '#075985',
                            900: '#0c4a6e',
                        },
                        secondary: {
                            50: '#fdf4ff',
                            100: '#fae8ff',
                            200: '#f5d0fe',
                            300: '#f0abfc',
                            400: '#e879f9',
                            500: '#d946ef',
                            600: '#c026d3',
                            700: '#a21caf',
                            800: '#86198f',
                            900: '#701a75',
                        }
                    }
                }
            }
        }
    </script>
    <style>
        .glass-effect {
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .analytics-grid {
            display: grid;
            gap: 1.5rem;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        }
        
        .performance-metric {
            transition: all 0.3s ease;
        }
        
        .performance-metric:hover {
            transform: translateY(-5px);
        }
        
        .sparkline {
            stroke: #0ea5e9;
            stroke-width: 2;
            fill: none;
        }
    </style>
</head>
<body class="bg-gray-900 text-white min-h-screen">
    <!-- Navigation -->
    <nav class="glass-effect border-b border-gray-800 sticky top-0 z-50">
        <div class="max-w-8xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between items-center h-16">
                <div class="flex items-center space-x-3">
                    <a href="index.html" class="flex items-center space-x-3">
                        <div class="w-10 h-10 bg-gradient-to-br from-primary-500 to-secondary-500 rounded-lg flex items-center justify-center">
                            <i data-feather="trending-up" class="w-6 h-6"></i>
                        </div>
                        <span class="text-xl font-bold bg-gradient-to-r from-primary-500 to-secondary-500 bg-clip-text text-transparent">QuantumTrade</span>
                    </a>
                </div>

                <div class="hidden md:flex items-center space-x-8">
                    <a href="index.html" class="text-gray-300 hover:text-white transition-colors duration-200">Dashboard</a>
                    <a href="trading.html" class="text-gray-300 hover:text-white transition-colors duration-200">Trading</a>
                    <a href="analytics.html" class="text-primary-400 hover:text-primary-300 transition-colors duration-200 font-medium">Analytics</a>
                    <a href="strategies.html" class="text-gray-300 hover:text-white transition-colors duration-200">Strategies</a>
                    <a href="monitoring.html" class="text-gray-300 hover:text-white transition-colors duration-200">Monitoring</a>
                </div>

                <div class="flex items-center space-x-4">
                    <div class="hidden md:flex items-center space-x-2 text-sm">
                        <span class="text-gray-400">Analytics</span>
                        <div class="w-2 h-2 bg-blue-500 rounded-full animate-pulse"></div>
                    </div>
                    <button class="p-2 rounded-lg glass-effect hover:bg-gray-800 transition-colors duration-200">
                        <i data-feather="settings" class="w-5 h-5"></i>
                    </button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Analytics Dashboard -->
    <main class="max-w-8xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <!-- Header -->
        <div class="mb-8">
            <h1 class="text-4xl font-bold mb-2">Advanced Analytics</h1>
            <p class="text-gray-400">Real-time performance metrics, predictive analytics, and trading insights</p>
        </div>

        <!-- Performance Overview -->
        <div class="grid grid-cols-1 lg:grid-cols-4 gap-6 mb-8">
            <div class="glass-effect rounded-2xl p-6 performance-metric">
                <div class="flex items-center justify-between mb-4">
                    <h3 class="text-lg font-semibold">Total Return</h3>
                    <i data-feather="dollar-sign" class="w-6 h-6 text-green-500"></i>
                </div>
                <div class="text-3xl font-bold text-green-500 mb-2">+28.7%</div>
                <div class="text-sm text-gray-400">YTD Performance</div>
                <div class="mt-4">
                    <canvas id="return-chart" height="60"></canvas>
                </div>
            </div>

            <div class="glass-effect rounded-2xl p-6 performance-metric">
                <div class="flex items-center justify-between mb-4">
                    <h3 class="text-lg font-semibold">Win Rate</h3>
                    <i data-feather="target" class="w-6 h-6 text-blue-500"></i>
                </div>
                <div class="text-3xl font-bold text-blue-500 mb-2">76.3%</div>
                <div class="text-sm text-gray-400">Successful Trades</div>
                <div class="mt-4">
                    <canvas id="winrate-chart" height="60"></canvas>
                </div>
            </div>

            <div class="glass-effect rounded-2xl p-6 performance-metric">
                <div class="flex items-center justify-between mb-4">
                    <h3 class="text-lg font-semibold">Sharpe Ratio</h3>
                    <i data-feather="trending-up" class="w-6 h-6 text-purple-500"></i>
                </div>
                <div class="text-3xl font-bold text-purple-500 mb-2">2.14</div>
                <div class="text-sm text-gray-400">Risk-Adjusted Return</div>
                <div class="mt-4">
                    <canvas id="sharpe-chart" height="60"></canvas>
                </div>
            </div>

            <div class="glass-effect rounded-2xl p-6 performance-metric">
                <div class="flex items-center justify-between mb-4">
                    <h3 class="text-lg font-semibold">Max Drawdown</h3>
                    <i data-feather="activity" class="w-6 h-6 text-yellow-500"></i>
                </div>
                <div class="text-3xl font-bold text-yellow-500 mb-2">-4.2%</div>
                <div class="text-sm text-gray-400">Peak to Trough</div>
                <div class="mt-4">
                    <canvas id="drawdown-chart" height="60"></canvas>
                </div>
            </div>
        </div>

        <!-- Main Charts Grid -->
        <div class="grid grid-cols-1 xl:grid-cols-2 gap-8 mb-8">
            <!-- Equity Curve -->
            <div class="glass-effect rounded-2xl p-6">
                <div class="flex justify-between items-center mb-6">
                    <h3 class="text-xl font-semibold">Equity Curve</h3>
                    <div class="flex space-x-2">
                        <button class="px-3 py-1 rounded-lg bg-primary-500 hover:bg-primary-600 transition-colors text-sm">1M</button>
                        <button class="px-3 py-1 rounded-lg bg-gray-800 hover:bg-gray-700 transition-colors text-sm">3M</button>
                        <button class="px-3 py-1 rounded-lg bg-gray-800 hover:bg-gray-700 transition-colors text-sm">1Y</button>
                        <button class="px-3 py-1 rounded-lg bg-gray-800 hover:bg-gray-700 transition-colors text-sm">All</button>
                    </div>
                </div>
                <div class="h-80">
                    <canvas id="equity-chart"></canvas>
                </div>
            </div>

            <!-- Portfolio Allocation -->
            <div class="glass-effect rounded-2xl p-6">
                <div class="flex justify-between items-center mb-6">
                    <h3 class="text-xl font-semibold">Portfolio Allocation</h3>
                    <div class="flex space-x-2">
                        <button class="px-3 py-1 rounded-lg bg-primary-500 hover:bg-primary-600 transition-colors text-sm">By Asset</button>
                        <button class="px-3 py-1 rounded-lg bg-gray-800 hover:bg-gray-700 transition-colors text-sm">By Strategy</button>
                    </div>
                </div>
                <div class="h-80">
                    <canvas id="allocation-chart"></canvas>
                </div>
            </div>
        </div>

        <!-- Detailed Analytics -->
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-8 mb-8">
            <!-- Trade Distribution -->
            <div class="glass-effect rounded-2xl p-6 lg:col-span-2">
                <h3 class="text-xl font-semibold mb-6">Trade Distribution Analysis</h3>
                <div class="h-64">
                    <canvas id="distribution-chart"></canvas>
                </div>
            </div>

            <!-- Performance Metrics -->
            <div class="glass-effect rounded-2xl p-6">
                <h3 class="text-xl font-semibold mb-6">Key Metrics</h3>
                <div class="space-y-6">
                    <div>
                        <div class="flex justify-between items-center mb-2">
                            <span class="text-gray-400">Profit Factor</span>
                            <span class="font-semibold">2.8</span>
                        </div>
                        <div class="w-full bg-gray-700 rounded-full h-2">
                            <div class="bg-green-500 h-2 rounded-full" style="width: 80%"></div>
                        </div>
                    </div>
                    <div>
                        <div class="flex justify-between items-center mb-2">
                            <span class="text-gray-400">Avg Trade Duration</span>
                            <span class="font-semibold">2.3h</span>
                        </div>
                        <div class="w-full bg-gray-700 rounded-full h-2">
                            <div class="bg-blue-500 h-2 rounded-full" style="width: 45%"></div>
                        </div>
                    </div>
                    <div>
                        <div class="flex justify-between items-center mb-2">
                            <span class="text-gray-400">Volatility</span>
                            <span class="font-semibold">12.4%</span>
                        </div>
                        <div class="w-full bg-gray-700 rounded-full h-2">
                            <div class="bg-yellow-500 h-2 rounded-full" style="width: 62%"></div>
                        </div>
                    </div>
                    <div>
                        <div class="flex justify-between items-center mb-2">
                            <span class="text-gray-400">Calmar Ratio</span>
                            <span class="font-semibold">3.1</span>
                        </div>
                        <div class="w-full bg-gray-700 rounded-full h-2">
                            <div class="bg-purple-500 h-2 rounded-full" style="width: 78%"></div>
                        </div>
                    </div>
                    <div>
                        <div class="flex justify-between items-center mb-2">
                            <span class="text-gray-400">Sortino Ratio</span>
                            <span class="font-semibold">2.9</span>
                        </div>
                        <div class="w-full bg-gray-700 rounded-full h-2">
                            <div class="bg-red-500 h-2 rounded-full" style="width: 72%"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Strategy Performance -->
        <div class="glass-effect rounded-2xl p-6 mb-8">
            <h3 class="text-xl font-semibold mb-6">Strategy Performance Comparison</h3>
            <div class="overflow-x-auto">
                <table class="w-full">
                    <thead class="bg-gray-800">
                        <tr>
                            <th class="px-6 py-3 text-left text-sm font-semibold">Strategy</th>
                            <th class="px-6 py-3 text-left text-sm font-semibold">Return</th>
                            <th class="px-6 py-3 text-left text-sm font-semibold">Win Rate</th>
                            <th class="px-6 py-3 text-left text-sm font-semibold">Sharpe</th>
                            <th class="px-6 py-3 text-left text-sm font-semibold">Max DD</th>
                            <th class="px-6 py-3 text-left text-sm font-semibold">Status</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-700">
                        <tr class="hover:bg-gray-800 transition-colors">
                            <td class="px-6 py-4">
                                <div class="flex items-center">
                                    <div class="w-3 h-3 bg-green-500 rounded-full mr-3"></div>
                                    Momentum Scalper
                                </div>
                            </td>
                            <td class="px-6 py-4 font-semibold text-green-500">+15.2%</td>
                            <td class="px-6 py-4">74.8%</td>
                            <td class="px-6 py-4">1.89</td>
                            <td class="px-6 py-4 text-red-500">-3.2%</td>
                            <td class="px-6 py-4">
                                <span class="px-3 py-1 rounded-full text-sm bg-green-500/20 text-green-500">Active</span>
                            </td>
                        </tr>
                        <tr class="hover:bg-gray-800 transition-colors">
                            <td class="px-6 py-4">
                                <div class="flex items-center">
                                    <div class="w-3 h-3 bg-blue-500 rounded-full mr-3"></div>
                                    Mean Reversion
                                </div>
                            </td>
                            <td class="px-6 py-4 font-semibold text-green-500">+9.7%</td>
                            <td class="px-6 py-4">68.3%</td>
                            <td class="px-6 py-4">1.45</td>
                            <td class="px-6 py-4 text-red-500">-5.1%</td>
                            <td class="px-6 py-4">
                                <span class="px-3 py-1 rounded-full text-sm bg-green-500/20 text-green-500">Active</span>
                            </td>
                        </tr>
                        <tr class="hover:bg-gray-800 transition-colors">
                            <td class="px-6 py-4">
                                <div class="flex items-center">
                                    <div class="w-3 h-3 bg-purple-500 rounded-full mr-3"></div>
                                    ML Trend Follower
                                </div>
                            </td>
                            <td class="px-6 py-4 font-semibold text-green-500">+22.4%</td>
                            <td class="px-6 py-4">81.2%</td>
                            <td class="px-6 py-4">2.34</td>
                            <td class="px-6 py-4 text-red-500">-2.8%</td>
                            <td class="px-6 py-4">
                                <span class="px-3 py-1 rounded-full text-sm bg-green-500/20 text-green-500">Active</span>
                            </td>
                        </tr>
                        <tr class="hover:bg-gray-800 transition-colors">
                            <td class="px-6 py-4">
                                <div class="flex items-center">
                                    <div class="w-3 h-3 bg-yellow-500 rounded-full mr-3"></div>
                                    Arbitrage Bot
                                </div>
                            </td>
                            <td class="px-6 py-4 font-semibold text-green-500">+5.3%</td>
                            <td class="px-6 py-4">92.1%</td>
                            <td class="px-6 py-4">0.87</td>
                            <td class="px-6 py-4 text-red-500">-1.2%</td>
                            <td class="px-6 py-4">
                                <span class="px-3 py-1 rounded-full text-sm bg-yellow-500/20 text-yellow-500">Testing</span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <!-- Predictive Analytics -->
        <div class="glass-effect rounded-2xl p-6">
            <h3 class="text-xl font-semibold mb-6">AI Predictive Analytics</h3>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div>
                    <h4 class="font-semibold mb-4 text-primary-400">Market Direction Forecast</h4>
                    <div class="space-y-4">
                        <div>
                            <div class="flex justify-between items-center mb-2">
                                <span class="text-gray-400">EUR/USD (Next 24h)</span>
                                <span class="font-semibold text-green-500">67% Bullish</span>
                            </div>
                            <div class="w-full bg-gray-700 rounded-full h-3">
                                <div class="bg-green-500 h-3 rounded-full" style="width: 67%"></div>
                            </div>
                        </div>
                        <div>
                            <div class="flex justify-between items-center mb-2">
                                <span class="text-gray-400">BTC/USD (Next 24h)</span>
                                <span class="font-semibold text-red-500">58% Bearish</span>
                            </div>
                            <div class="w-full bg-gray-700 rounded-full h-3">
                                <div class="bg-red-500 h-3 rounded-full" style="width: 58%"></div>
                            </div>
                        </div>
                        <div>
                            <div class="flex justify-between items-center mb-2">
                                <span class="text-gray-400">SPX (Next Week)</span>
                                <span class="font-semibold text-green-500">72% Bullish</span>
                            </div>
                            <div class="w-full bg-gray-700 rounded-full h-3">
                                <div class="bg-green-500 h-3 rounded-full" style="width: 72%"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div>
                    <h4 class="font-semibold mb-4 text-secondary-400">Risk Assessment</h4>
                    <div class="space-y-4">
                        <div>
                            <div class="flex justify-between items-center mb-2">
                                <span class="text-gray-400">Portfolio Risk Score</span>
                                <span class="font-semibold">Medium (6.2/10)</span>
                            </div>
                            <div class="w-full bg-gray-700 rounded-full h-3">
                                <div class="bg-yellow-500 h-3 rounded-full" style="width: 62%"></div>
                            </div>
                        </div>
                        <div>
                            <div class="flex justify-between items-center mb-2">
                                <span class="text-gray-400">Volatility Forecast</span>
                                <span class="font-semibold">Increasing (+15%)</span>
                            </div>
                            <div class="w-full bg-gray-700 rounded-full h-3">
                                <div class="bg-orange-500 h-3 rounded-full" style="width: 45%"></div>
                            </div>
                        </div>
                        <div>
                            <div class="flex justify-between items-center mb-2">
                                <span class="text-gray-400">Correlation Alert</span>
                                <span class="font-semibold text-red-500">High (>0.8)</span>
                            </div>
                            <div class="w-full bg-gray-700 rounded-full h-3">
                                <div class="bg-red-500 h-3 rounded-full" style="width: 82%"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <script>
        // Initialize Feather Icons
        feather.replace();

        // Small Sparkline Charts
        function createSparklineChart(canvasId, data, color) {
            const ctx = document.getElementById(canvasId).getContext('2d');
            return new Chart(ctx, {
                type: 'line',
                data: {
                    labels: data.map((_, i) => i),
                    datasets: [{
                        data: data,
                        borderColor: color,
                        borderWidth: 2,
                        fill: false,
                        pointRadius: 0,
                        tension: 0.4
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: { legend: { display: false } },
                    scales: {
                        x: { display: false },
                        y: { display: false }
                    }
                }
            });
        }

        // Equity Curve Chart
        const equityCtx = document.getElementById('equity-chart').getContext('2d');
        const equityChart = new Chart(equityCtx, {
            type: 'line',
            data: {
                labels: Array.from({length: 30}, (_, i) => `Day ${i+1}`),
                datasets: [{
                    label: 'Portfolio Value',
                    data: Array.from({length: 30}, () => 10000 + Math.random() * 5000),
                    borderColor: '#0ea5e9',
                    backgroundColor: 'rgba(14, 165, 233, 0.1)',
                    fill: true,
                    tension: 0.4
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: { display: false }
                },
                scales: {
                    x: {
                        grid: { color: 'rgba(255, 255, 255, 0.1)' },
                        ticks: { color: 'rgba(255, 255, 255, 0.7)' }
                    },
                    y: {
                        grid: { color: 'rgba(255, 255, 255, 0.1)' },
                        ticks: { color: 'rgba(255, 255, 255, 0.7)' }
                    }
                }
            }
        });

        // Portfolio Allocation Chart
        const allocCtx = document.getElementById('allocation-chart').getContext('2d');
        const allocChart = new Chart(allocCtx, {
            type: 'doughnut',
            data: {
                labels: ['Forex', 'Crypto', 'Indices', 'Stocks', 'Commodities'],
                datasets: [{
                    data: [35, 25, 20, 15, 5],
                    backgroundColor: [
                        '#0ea5e9', '#d946ef', '#10b981', '#f59e0b', '#ef4444'
                    ],
                    borderWidth: 0
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: {
                        position: 'right',
                        labels: { color: 'rgba(255, 255, 255, 0.7)' }
                    }
                }
            }
        });

        // Trade Distribution Chart
        const distCtx = document.getElementById('distribution-chart').getContext('2d');
        const distChart = new Chart(distCtx, {
            type: 'bar',
            data: {
                labels: ['<1h', '1-4h', '4-8h', '8-24h', '1-7d', '>7d'],
                datasets: [{
                    label: 'Trade Duration',
                    data: [12, 28, 35, 18, 5, 2],
                    backgroundColor: '#0ea5e9',
                    borderColor: '#0ea5e9',
                    borderWidth: 1
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                plugins: { legend: { display: false } },
                scales: {
                    x: {
                        grid: { color: 'rgba(255, 255, 255, 0.1)' },
                        ticks: { color: 'rgba(255, 255, 255, 0.7)' }
                    },
                    y: {
                        grid: { color: 'rgba(255, 255, 255, 0.1)' },
                        ticks: { color: 'rgba(255, 255, 255, 0.7)' }
                    }
                }
            }
        });

        // Initialize sparklines
        createSparklineChart('return-chart', Array.from({length: 20}, () => Math.random() * 100), '#10b981');
        createSparklineChart('winrate-chart', Array.from({length: 20}, () => 70 + Math.random() * 10), '#3b82f6');
        createSparklineChart('sharpe-chart', Array.from({length: 20}, () => 1.5 + Math.random() * 1), '#8b5cf6');
        createSparklineChart('drawdown-chart', Array.from({length: 20}, () => -Math.random() * 5), '#f59e0b');

        // Add animations
        anime({
            targets: '.performance-metric',
            translateY: [50, 0],
            opacity: [0, 1],
            duration: 1000,
            delay: anime.stagger(100),
            easing: 'easeOutQuad'
        });
    </script>
</body>
</html>