File size: 18,718 Bytes
c11753d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Backtesting - AlgoGenius TraderBot</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        .sidebar {
            transition: all 0.3s ease;
        }
        .sidebar-collapsed {
            width: 5rem;
        }
        .sidebar-collapsed .nav-text {
            display: none;
        }
        .content {
            transition: margin-left 0.3s ease;
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
    </style>
</head>
<body class="bg-gray-50">
    <div class="flex h-screen overflow-hidden">
        <!-- Sidebar -->
        <div class="sidebar bg-white w-64 border-r border-gray-200 flex flex-col">
            <div class="flex items-center justify-center h-16 px-4 border-b border-gray-200">
                <div class="flex items-center">
                    <i data-feather="activity" class="h-6 w-6 text-primary-500"></i>
                    <span class="ml-2 text-lg font-semibold text-gray-900">AlgoGenius</span>
                </div>
            </div>
            <div class="flex-grow overflow-y-auto">
                <nav class="px-2 py-4">
                    <div class="space-y-1">
                        <a href="dashboard.html" class="text-gray-600 hover:bg-gray-50 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md">
                            <i data-feather="home" class="text-gray-400 group-hover:text-gray-500 mr-3 h-5 w-5"></i>
                            <span class="nav-text">Dashboard</span>
                        </a>
                        <a href="strategies.html" class="text-gray-600 hover:bg-gray-50 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md">
                            <i data-feather="bar-chart-2" class="text-gray-400 group-hover:text-gray-500 mr-3 h-5 w-5"></i>
                            <span class="nav-text">Strategies</span>
                        </a>
                        <a href="telegram.html" class="text-gray-600 hover:bg-gray-50 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md">
                            <i data-feather="download" class="text-gray-400 group-hover:text-gray-500 mr-3 h-5 w-5"></i>
                            <span class="nav-text">Telegram Feeds</span>
                        </a>
                        <a href="models.html" class="text-gray-600 hover:bg-gray-50 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md">
                            <i data-feather="cpu" class="text-gray-400 group-hover:text-gray-500 mr-3 h-5 w-5"></i>
                            <span class="nav-text">AI Models</span>
                        </a>
                        <a href="backtesting.html" class="bg-primary-50 text-primary-600 group flex items-center px-2 py-2 text-sm font-medium rounded-md">
                            <i data-feather="clock" class="text-primary-500 mr-3 h-5 w-5"></i>
                            <span class="nav-text">Backtesting</span>
                        </a>
                        <a href="settings.html" class="text-gray-600 hover:bg-gray-50 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md">
                            <i data-feather="settings" class="text-gray-400 group-hover:text-gray-500 mr-3 h-5 w-5"></i>
                            <span class="nav-text">Settings</span>
                        </a>
                    </div>
                </nav>
            </div>
            <div class="p-4 border-t border-gray-200">
                <button class="w-full flex items-center justify-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-500 hover:bg-primary-600">
                    <i data-feather="plus" class="mr-2 h-4 w-4"></i>
                    <span class="nav-text">New Test</span>
                </button>
            </div>
        </div>

        <!-- Main content -->
        <div class="content flex-1 overflow-auto">
            <!-- Top navigation -->
            <header class="bg-white shadow-sm">
                <div class="px-4 py-4 sm:px-6 lg:px-8 flex justify-between items-center">
                    <div class="flex items-center">
                        <button class="mr-4 text-gray-500 hover:text-gray-600 focus:outline-none">
                            <i data-feather="menu"></i>
                        </button>
                        <h1 class="text-lg font-semibold leading-6 text-gray-900">Strategy Backtesting</h1>
                    </div>
                    <div class="flex items-center space-x-4">
                        <div class="relative">
                            <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                <i data-feather="search" class="h-5 w-5 text-gray-400"></i>
                            </div>
                            <input type="text" class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm" placeholder="Search tests...">
                        </div>
                        <button class="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-500 hover:bg-primary-600">
                            <i data-feather="plus" class="mr-2 h-4 w-4"></i> New Test
                        </button>
                    </div>
                </div>
            </header>

            <!-- Main content area -->
            <main class="p-4 sm:p-6 lg:p-8">
                <div class="mb-6">
                    <h2 class="text-lg font-medium text-gray-900">Recent Backtests</h2>
                    <p class="mt-1 text-sm text-gray-500">View and analyze historical performance of your strategies</p>
                </div>

                <!-- Backtest results -->
                <div class="bg-white shadow rounded-lg overflow-hidden mb-8">
                    <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
                        <h3 class="text-lg leading-6 font-medium text-gray-900">Breakout Strategy - BTC/USD</h3>
                        <p class="mt-1 text-sm text-gray-500">Last run: 2 hours ago</p>
                    </div>
                    <div class="px-4 py-5 sm:p-6">
                        <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-4">
                            <div>
                                <p class="text-sm font-medium text-gray-500">Period</p>
                                <p class="mt-1 text-sm font-semibold text-gray-900">Jan 2022 - Present</p>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-500">Total Return</p>
                                <p class="mt-1 text-sm font-semibold text-green-600">+142.3%</p>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-500">Win Rate</p>
                                <p class="mt-1 text-sm font-semibold text-gray-900">68.7%</p>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-500">Profit Factor</p>
                                <p class="mt-1 text-sm font-semibold text-gray-900">2.15</p>
                            </div>
                        </div>
                        <div class="mt-6">
                            <canvas id="backtestChart" class="w-full h-64"></canvas>
                        </div>
                    </div>
                    <div class="px-4 py-4 sm:px-6 border-t border-gray-200 bg-gray-50 flex justify-end">
                        <button class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 mr-3">
                            <i data-feather="download" class="mr-2 h-4 w-4"></i> Export
                        </button>
                        <button class="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-500 hover:bg-primary-600">
                            <i data-feather="repeat" class="mr-2 h-4 w-4"></i> Run Again
                        </button>
                    </div>
                </div>

                <!-- Previous backtests -->
                <div class="mb-6 flex justify-between items-center">
                    <h2 class="text-lg font-medium text-gray-900">Previous Backtests</h2>
                    <a href="#" class="text-sm font-medium text-primary-600 hover:text-primary-500">View all</a>
                </div>
                <div class="overflow-x-auto">
                    <table class="min-w-full divide-y divide-gray-200">
                        <thead class="bg-gray-50">
                            <tr>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Strategy</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Symbol</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Period</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Return</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Win Rate</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-gray-200">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">SMC Breakout</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">ETH/USD</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Mar 2022 - Present</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 font-medium">+87.5%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">65.3%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 hours ago</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <a href="#" class="text-primary-600 hover:text-primary-900 mr-3">View</a>
                                    <a href="#" class="text-gray-600 hover:text-gray-900">Delete</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">AI Trend</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">AAPL</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Jan 2022 - Present</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 font-medium">+43.2%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">71.8%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">1 day ago</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <a href="#" class="text-primary-600 hover:text-primary-900 mr-3">View</a>
                                    <a href="#" class="text-gray-600 hover:text-gray-900">Delete</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Scalper Pro</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">EUR/USD</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Feb 2022 - Present</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-red-600 font-medium">-12.4%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">53.7%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">3 days ago</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <a href="#" class="text-primary-600 hover:text-primary-900 mr-3">View</a>
                                    <a href="#" class="text-gray-600 hover:text-gray-900">Delete</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Volume Spike</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">TSLA</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Dec 2021 - Present</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 font-medium">+92.1%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">62.4%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">1 week ago</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <a href="#" class="text-primary-600 hover:text-primary-900 mr-3">View</a>
                                    <a href="#" class="text-gray-600 hover:text-gray-900">Delete</a>
                                </td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Reversal Alert</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">BTC/USD</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Nov 2021 - Present</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 font-medium">+156.8%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">59.2%</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 weeks ago</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <a href="#" class="text-primary-600 hover:text-primary-900 mr-3">View</a>
                                    <a href="#" class="text-gray-600 hover:text-gray-900">Delete</a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </main>
        </div>
    </div>

    <script>
        // Initialize feather icons
        feather.replace();
        
        // Initialize backtest chart
        document.addEventListener('DOMContentLoaded', function() {
            const backtestCtx = document.getElementById('backtestChart').getContext('2d');
            const backtestChart = new Chart(backtestCtx, {
                type: 'line',
                data: {
                    labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
                    datasets: [{
                        label: 'Strategy Equity',
                        data: [10000, 11500, 12100, 13400, 14200, 15800, 16500],
                        backgroundColor: 'rgba(16, 185, 129, 0.1)',
                        borderColor: 'rgba(16, 185, 129, 1)',
                        borderWidth: 2,
                        tension: 0.3,
                        fill: true
                    }, {
                        label: 'Buy & Hold',
                        data: [10000, 10200, 9800, 10500, 11000, 11200, 11500],
                        backgroundColor: 'rgba(156, 163, 175, 0.1)',
                        borderColor: 'rgba(156, 163, 175, 1)',
                        borderWidth: 2,
                        tension: 0.3,
                        fill: true
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            position: 'top',
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: false
                        }
                    }
                }
            });

            // Collapse sidebar functionality
            const sidebar = document.querySelector('.sidebar');
            const toggleBtn = document.querySelector('header button');
            
            toggleBtn.addEventListener('click', function() {
                sidebar.classList.toggle('sidebar-collapsed');
                document.querySelector('.content').classList.toggle('ml-20');
                document.querySelector('.content').classList.toggle('ml-64');
            });
        });
    </script>
</body>
</html>