note6 commited on
Commit
643eccb
·
verified ·
1 Parent(s): 0ccb793

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +1883 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Btcpromulti
3
- emoji: 🌖
4
- colorFrom: blue
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: btcpromulti
3
+ emoji: 🐳
4
+ colorFrom: purple
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1883 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Bitcoin Price Predictor</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/luxon@2.0.2"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.0.0"></script>
11
+ <script src="https://accounts.google.com/gsi/client" async defer></script>
12
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
13
+ <style>
14
+ * {
15
+ box-sizing: border-box;
16
+ margin: 0;
17
+ padding: 0;
18
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
19
+ }
20
+
21
+ body {
22
+ background-color: #f5f7fa;
23
+ color: #333;
24
+ line-height: 1.6;
25
+ }
26
+
27
+ .container {
28
+ width: 100%;
29
+ max-width: 1200px;
30
+ margin: 0 auto;
31
+ padding: 20px;
32
+ }
33
+
34
+ /* Header styles */
35
+ header {
36
+ display: flex;
37
+ justify-content: space-between;
38
+ align-items: center;
39
+ margin-bottom: 30px;
40
+ flex-wrap: wrap;
41
+ }
42
+
43
+ .header-title {
44
+ display: flex;
45
+ align-items: center;
46
+ font-size: 28px;
47
+ font-weight: bold;
48
+ color: #2d3748;
49
+ }
50
+
51
+ .header-title i {
52
+ color: #f7931a;
53
+ margin-right: 10px;
54
+ }
55
+
56
+ .header-controls {
57
+ display: flex;
58
+ align-items: center;
59
+ }
60
+
61
+ .refresh-btn {
62
+ background-color: #3182ce;
63
+ color: white;
64
+ border: none;
65
+ padding: 8px 16px;
66
+ border-radius: 6px;
67
+ cursor: pointer;
68
+ display: flex;
69
+ align-items: center;
70
+ margin-right: 15px;
71
+ transition: background-color 0.3s;
72
+ }
73
+
74
+ .refresh-btn:hover {
75
+ background-color: #2c5282;
76
+ }
77
+
78
+ .refresh-btn i {
79
+ margin-right: 5px;
80
+ }
81
+
82
+ .last-updated {
83
+ font-size: 14px;
84
+ color: #718096;
85
+ }
86
+
87
+ .header-subtitle {
88
+ width: 100%;
89
+ margin-top: 10px;
90
+ color: #4a5568;
91
+ font-size: 14px;
92
+ }
93
+
94
+ /* Login section */
95
+ .login-section {
96
+ display: flex;
97
+ justify-content: flex-end;
98
+ margin-bottom: 20px;
99
+ }
100
+
101
+ .user-info {
102
+ display: flex;
103
+ align-items: center;
104
+ }
105
+
106
+ .user-avatar {
107
+ width: 32px;
108
+ height: 32px;
109
+ border-radius: 50%;
110
+ margin-right: 10px;
111
+ }
112
+
113
+ .user-name {
114
+ font-size: 14px;
115
+ margin-right: 10px;
116
+ }
117
+
118
+ .logout-btn {
119
+ background: none;
120
+ border: none;
121
+ color: #3182ce;
122
+ cursor: pointer;
123
+ font-size: 14px;
124
+ }
125
+
126
+ /* Card grid */
127
+ .card-grid {
128
+ display: flex;
129
+ flex-wrap: wrap;
130
+ gap: 20px;
131
+ margin-bottom: 30px;
132
+ }
133
+
134
+ .card {
135
+ flex: 1;
136
+ min-width: 250px;
137
+ background: white;
138
+ border-radius: 10px;
139
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
140
+ padding: 20px;
141
+ transition: transform 0.3s, box-shadow 0.3s;
142
+ }
143
+
144
+ .card:hover {
145
+ transform: translateY(-5px);
146
+ box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
147
+ }
148
+
149
+ .card-header {
150
+ display: flex;
151
+ justify-content: space-between;
152
+ align-items: center;
153
+ margin-bottom: 15px;
154
+ }
155
+
156
+ .card-title {
157
+ font-size: 18px;
158
+ font-weight: 600;
159
+ color: #2d3748;
160
+ }
161
+
162
+ .card-badge {
163
+ font-size: 12px;
164
+ padding: 3px 8px;
165
+ border-radius: 20px;
166
+ background-color: #e2e8f0;
167
+ color: #4a5568;
168
+ }
169
+
170
+ .card-content {
171
+ display: flex;
172
+ flex-direction: column;
173
+ }
174
+
175
+ .price-large {
176
+ font-size: 28px;
177
+ font-weight: 700;
178
+ color: #2d3748;
179
+ }
180
+
181
+ .price-change {
182
+ display: flex;
183
+ align-items: center;
184
+ font-size: 14px;
185
+ margin-left: 10px;
186
+ }
187
+
188
+ .price-up {
189
+ color: #38a169;
190
+ }
191
+
192
+ .price-down {
193
+ color: #e53e3e;
194
+ }
195
+
196
+ .card-stats {
197
+ display: flex;
198
+ font-size: 13px;
199
+ color: #718096;
200
+ margin-top: 10px;
201
+ }
202
+
203
+ .card-stats span {
204
+ margin: 0 5px;
205
+ }
206
+
207
+ /* Timeframe tabs */
208
+ .timeframe-tabs {
209
+ display: flex;
210
+ margin-bottom: 15px;
211
+ border-bottom: 1px solid #e2e8f0;
212
+ }
213
+
214
+ .timeframe-tab {
215
+ padding: 10px 20px;
216
+ cursor: pointer;
217
+ border-bottom: 2px solid transparent;
218
+ font-size: 14px;
219
+ font-weight: 500;
220
+ color: #718096;
221
+ }
222
+
223
+ .timeframe-tab.active {
224
+ color: #3182ce;
225
+ border-bottom-color: #3182ce;
226
+ }
227
+
228
+ /* Main chart */
229
+ .chart-container {
230
+ background: white;
231
+ border-radius: 10px;
232
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
233
+ padding: 20px;
234
+ margin-bottom: 30px;
235
+ }
236
+
237
+ .chart-header {
238
+ display: flex;
239
+ justify-content: space-between;
240
+ align-items: center;
241
+ margin-bottom: 20px;
242
+ }
243
+
244
+ .chart-title {
245
+ font-size: 20px;
246
+ font-weight: 600;
247
+ color: #2d3748;
248
+ }
249
+
250
+ .chart-wrapper {
251
+ height: 400px;
252
+ position: relative;
253
+ }
254
+
255
+ /* Prediction methods */
256
+ .methods-grid {
257
+ display: flex;
258
+ flex-wrap: wrap;
259
+ gap: 20px;
260
+ margin-bottom: 30px;
261
+ }
262
+
263
+ .method-card {
264
+ flex: 1;
265
+ min-width: 250px;
266
+ background: white;
267
+ border-radius: 10px;
268
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
269
+ padding: 20px;
270
+ }
271
+
272
+ .method-header {
273
+ display: flex;
274
+ justify-content: space-between;
275
+ align-items: center;
276
+ margin-bottom: 15px;
277
+ }
278
+
279
+ .method-title {
280
+ font-size: 16px;
281
+ font-weight: 600;
282
+ color: #2d3748;
283
+ }
284
+
285
+ .method-badge {
286
+ font-size: 11px;
287
+ padding: 3px 8px;
288
+ border-radius: 20px;
289
+ }
290
+
291
+ .method-content {
292
+ margin-bottom: 15px;
293
+ }
294
+
295
+ .method-row {
296
+ display: flex;
297
+ justify-content: space-between;
298
+ font-size: 14px;
299
+ color: #4a5568;
300
+ margin-bottom: 8px;
301
+ }
302
+
303
+ .method-value {
304
+ font-weight: 500;
305
+ }
306
+
307
+ .method-footer {
308
+ font-size: 12px;
309
+ color: #718096;
310
+ display: flex;
311
+ align-items: center;
312
+ }
313
+
314
+ .method-footer i {
315
+ margin-right: 5px;
316
+ }
317
+
318
+ /* History table */
319
+ .history-container {
320
+ background: white;
321
+ border-radius: 10px;
322
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
323
+ padding: 20px;
324
+ margin-bottom: 30px;
325
+ }
326
+
327
+ .history-header {
328
+ display: flex;
329
+ justify-content: space-between;
330
+ align-items: center;
331
+ margin-bottom: 20px;
332
+ }
333
+
334
+ .history-title {
335
+ font-size: 20px;
336
+ font-weight: 600;
337
+ color: #2d3748;
338
+ }
339
+
340
+ .export-btn {
341
+ background-color: #e2e8f0;
342
+ color: #4a5568;
343
+ border: none;
344
+ padding: 6px 12px;
345
+ border-radius: 6px;
346
+ cursor: pointer;
347
+ display: flex;
348
+ align-items: center;
349
+ font-size: 14px;
350
+ transition: background-color 0.3s;
351
+ }
352
+
353
+ .export-btn:hover {
354
+ background-color: #cbd5e0;
355
+ }
356
+
357
+ .export-btn i {
358
+ margin-right: 5px;
359
+ }
360
+
361
+ .history-table {
362
+ width: 100%;
363
+ border-collapse: collapse;
364
+ }
365
+
366
+ .history-table th {
367
+ text-align: left;
368
+ padding: 12px 15px;
369
+ font-size: 13px;
370
+ font-weight: 600;
371
+ color: #718096;
372
+ background-color: #f8fafc;
373
+ border-bottom: 1px solid #e2e8f0;
374
+ }
375
+
376
+ .history-table td {
377
+ padding: 12px 15px;
378
+ font-size: 14px;
379
+ color: #4a5568;
380
+ border-bottom: 1px solid #e2e8f0;
381
+ }
382
+
383
+ .history-table tr:nth-child(even) {
384
+ background-color: #f8fafc;
385
+ }
386
+
387
+ /* Settings */
388
+ .settings-container {
389
+ background: white;
390
+ border-radius: 10px;
391
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
392
+ padding: 20px;
393
+ }
394
+
395
+ .settings-title {
396
+ font-size: 20px;
397
+ font-weight: 600;
398
+ color: #2d3748;
399
+ margin-bottom: 20px;
400
+ }
401
+
402
+ .settings-grid {
403
+ display: flex;
404
+ flex-wrap: wrap;
405
+ gap: 30px;
406
+ }
407
+
408
+ .settings-section {
409
+ flex: 1;
410
+ min-width: 300px;
411
+ }
412
+
413
+ .section-title {
414
+ font-size: 16px;
415
+ font-weight: 600;
416
+ color: #2d3748;
417
+ margin-bottom: 15px;
418
+ }
419
+
420
+ .auto-refresh {
421
+ display: flex;
422
+ align-items: center;
423
+ margin-bottom: 15px;
424
+ }
425
+
426
+ .auto-refresh input {
427
+ margin-right: 10px;
428
+ }
429
+
430
+ .next-refresh {
431
+ font-size: 14px;
432
+ color: #718096;
433
+ }
434
+
435
+ .weight-control {
436
+ margin-bottom: 10px;
437
+ display: flex;
438
+ align-items: center;
439
+ }
440
+
441
+ .weight-label {
442
+ width: 150px;
443
+ font-size: 14px;
444
+ }
445
+
446
+ .weight-slider {
447
+ flex: 1;
448
+ margin: 0 10px;
449
+ }
450
+
451
+ .weight-value {
452
+ width: 40px;
453
+ text-align: right;
454
+ font-size: 14px;
455
+ }
456
+
457
+ /* Colors for badges */
458
+ .badge-blue {
459
+ background-color: #ebf8ff;
460
+ color: #3182ce;
461
+ }
462
+
463
+ .badge-purple {
464
+ background-color: #faf5ff;
465
+ color: #805ad5;
466
+ }
467
+
468
+ .badge-red {
469
+ background-color: #fff5f5;
470
+ color: #e53e3e;
471
+ }
472
+
473
+ .badge-green {
474
+ background-color: #f0fff4;
475
+ color: #38a169;
476
+ }
477
+
478
+ .badge-yellow {
479
+ background-color: #fffff0;
480
+ color: #d69e2e;
481
+ }
482
+
483
+ .badge-indigo {
484
+ background-color: #ebf4ff;
485
+ color: #5c6ac4;
486
+ }
487
+
488
+ .badge-pink {
489
+ background-color: #fff5f7;
490
+ color: #d53f8c;
491
+ }
492
+
493
+ /* Tooltip */
494
+ .tooltip {
495
+ position: relative;
496
+ display: inline-block;
497
+ }
498
+
499
+ .tooltip .tooltiptext {
500
+ visibility: hidden;
501
+ width: 200px;
502
+ background-color: #333;
503
+ color: #fff;
504
+ text-align: center;
505
+ border-radius: 6px;
506
+ padding: 5px;
507
+ position: absolute;
508
+ z-index: 1;
509
+ bottom: 125%;
510
+ left: 50%;
511
+ margin-left: -100px;
512
+ opacity: 0;
513
+ transition: opacity 0.3s;
514
+ font-size: 12px;
515
+ }
516
+
517
+ .tooltip:hover .tooltiptext {
518
+ visibility: visible;
519
+ opacity: 1;
520
+ }
521
+
522
+ /* Responsive adjustments */
523
+ @media (max-width: 768px) {
524
+ .card, .method-card {
525
+ min-width: 100%;
526
+ }
527
+
528
+ .header-title {
529
+ font-size: 24px;
530
+ margin-bottom: 10px;
531
+ }
532
+
533
+ .header-controls {
534
+ width: 100%;
535
+ justify-content: space-between;
536
+ }
537
+
538
+ .chart-wrapper {
539
+ height: 300px;
540
+ }
541
+ }
542
+ </style>
543
+ </head>
544
+ <body>
545
+ <div class="container">
546
+ <!-- Login Section -->
547
+ <div class="login-section" id="loginSection">
548
+ <div id="g_id_onload"
549
+ data-client_id="YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com"
550
+ data-callback="handleCredentialResponse"
551
+ data-auto_prompt="false">
552
+ </div>
553
+ <div class="g_id_signin"
554
+ data-type="standard"
555
+ data-size="medium"
556
+ data-theme="outline"
557
+ data-text="sign_in_with"
558
+ data-shape="rectangular"
559
+ data-logo_alignment="left">
560
+ </div>
561
+ </div>
562
+
563
+ <header>
564
+ <div class="header-title">
565
+ <i class="fab fa-bitcoin"></i> Bitcoin Price Predictor
566
+ </div>
567
+ <div class="header-controls">
568
+ <button id="refreshBtn" class="refresh-btn">
569
+ <i class="fas fa-sync-alt"></i> Actualizar
570
+ </button>
571
+ <span id="lastUpdated" class="last-updated"></span>
572
+ </div>
573
+ <div class="header-subtitle">
574
+ Predicciones combinadas de múltiples modelos para los próximos periodos
575
+ </div>
576
+ </header>
577
+
578
+ <div class="card-grid">
579
+ <!-- Current Price Card -->
580
+ <div class="card">
581
+ <div class="card-header">
582
+ <div class="card-title">Precio Actual</div>
583
+ <span class="card-badge">En tiempo real</span>
584
+ </div>
585
+ <div class="card-content">
586
+ <div style="display: flex; align-items: flex-end;">
587
+ <span id="currentPrice" class="price-large">$--</span>
588
+ <span id="priceChange" class="price-change">
589
+ <span class="change-arrow"></span>
590
+ <span class="change-percent"></span>
591
+ </span>
592
+ </div>
593
+ <div class="card-stats">
594
+ <span id="marketCap">Capitalización: $--</span>
595
+ <span>|</span>
596
+ <span id="volume">Volumen: $--</span>
597
+ </div>
598
+ </div>
599
+ </div>
600
+
601
+ <!-- Combined Prediction Card -->
602
+ <div class="card">
603
+ <div class="card-header">
604
+ <div class="card-title">Predicción Combinada</div>
605
+ <span class="card-badge badge-blue">Próxima hora</span>
606
+ </div>
607
+ <div class="card-content">
608
+ <div style="display: flex; align-items: flex-end;">
609
+ <span id="combinedPrediction" class="price-large">$--</span>
610
+ <span id="combinedConfidence" style="margin-left: 10px; font-size: 14px;">
611
+ <span class="confidence-value"></span>
612
+ <span class="confidence-text"></span>
613
+ </span>
614
+ </div>
615
+ <div class="card-stats">
616
+ <span id="predictionDirection">Dirección: --</span>
617
+ <span>|</span>
618
+ <span id="predictionStrength">Fuerza: --</span>
619
+ </div>
620
+ </div>
621
+ </div>
622
+
623
+ <!-- Accuracy Card -->
624
+ <div class="card">
625
+ <div class="card-header">
626
+ <div class="card-title">Precisión Histórica</div>
627
+ <span class="card-badge badge-green">Últimas 24h</span>
628
+ </div>
629
+ <div class="card-content" style="flex-direction: row; align-items: center;">
630
+ <div style="width: 80px; height: 80px; margin-right: 15px;">
631
+ <canvas id="accuracyGauge"></canvas>
632
+ </div>
633
+ <div>
634
+ <div style="font-size: 14px; color: #4a5568; margin-bottom: 5px;">
635
+ Precisión media: <span id="avgAccuracy" style="font-weight: 500;">--%</span>
636
+ </div>
637
+ <div style="font-size: 14px; color: #4a5568;">
638
+ Predicciones correctas: <span id="correctPredictions" style="font-weight: 500;">--/--</span>
639
+ </div>
640
+ </div>
641
+ </div>
642
+ </div>
643
+ </div>
644
+
645
+ <!-- Timeframe Tabs -->
646
+ <div class="timeframe-tabs">
647
+ <div class="timeframe-tab active" data-timeframe="1h">1 Hora</div>
648
+ <div class="timeframe-tab" data-timeframe="8h">8 Horas</div>
649
+ <div class="timeframe-tab" data-timeframe="12h">12 Horas</div>
650
+ <div class="timeframe-tab" data-timeframe="24h">24 Horas</div>
651
+ </div>
652
+
653
+ <!-- Main Chart -->
654
+ <div class="chart-container">
655
+ <div class="chart-header">
656
+ <div class="chart-title">Precio de Bitcoin con Predicciones</div>
657
+ </div>
658
+ <div class="chart-wrapper">
659
+ <canvas id="priceChart"></canvas>
660
+ </div>
661
+ </div>
662
+
663
+ <!-- Prediction Methods -->
664
+ <h2 style="font-size: 20px; font-weight: 600; color: #2d3748; margin-bottom: 15px;">Métodos de Predicción</h2>
665
+ <div class="methods-grid">
666
+ <!-- Technical Indicators -->
667
+ <div class="method-card">
668
+ <div class="method-header">
669
+ <div class="method-title">Indicadores Técnicos</div>
670
+ <span class="method-badge badge-purple">RSI, MACD, Bollinger</span>
671
+ </div>
672
+ <div class="method-content">
673
+ <div class="method-row">
674
+ <span>Predicción:</span>
675
+ <span id="tiPrediction" class="method-value">$--</span>
676
+ </div>
677
+ <div class="method-row">
678
+ <span>Confianza:</span>
679
+ <span id="tiConfidence" class="method-value">--%</span>
680
+ </div>
681
+ <div class="method-row">
682
+ <span>Dirección:</span>
683
+ <span id="tiDirection" class="method-value">--</span>
684
+ </div>
685
+ </div>
686
+ <div class="method-footer">
687
+ <i class="fas fa-info-circle"></i> Combinación de RSI, MACD, Medias Móviles y Bandas de Bollinger
688
+ </div>
689
+ </div>
690
+
691
+ <!-- Machine Learning -->
692
+ <div class="method-card">
693
+ <div class="method-header">
694
+ <div class="method-title">Aprendizaje Automático</div>
695
+ <span class="method-badge badge-red">Random Forest, XGBoost</span>
696
+ </div>
697
+ <div class="method-content">
698
+ <div class="method-row">
699
+ <span>Predicción:</span>
700
+ <span id="mlPrediction" class="method-value">$--</span>
701
+ </div>
702
+ <div class="method-row">
703
+ <span>Confianza:</span>
704
+ <span id="mlConfidence" class="method-value">--%</span>
705
+ </div>
706
+ <div class="method-row">
707
+ <span>Precisión histórica:</span>
708
+ <span id="mlAccuracy" class="method-value">--%</span>
709
+ </div>
710
+ </div>
711
+ <div class="method-footer">
712
+ <i class="fas fa-info-circle"></i> Modelos entrenados con datos históricos de precios y volumen
713
+ </div>
714
+ </div>
715
+
716
+ <!-- Deep Learning -->
717
+ <div class="method-card">
718
+ <div class="method-header">
719
+ <div class="method-title">Aprendizaje Profundo</div>
720
+ <span class="method-badge badge-green">LSTM, GRU</span>
721
+ </div>
722
+ <div class="method-content">
723
+ <div class="method-row">
724
+ <span>Predicción:</span>
725
+ <span id="dlPrediction" class="method-value">$--</span>
726
+ </div>
727
+ <div class="method-row">
728
+ <span>Confianza:</span>
729
+ <span id="dlConfidence" class="method-value">--%</span>
730
+ </div>
731
+ <div class="method-row">
732
+ <span>Precisión histórica:</span>
733
+ <span id="dlAccuracy" class="method-value">--%</span>
734
+ </div>
735
+ </div>
736
+ <div class="method-footer">
737
+ <i class="fas fa-info-circle"></i> Redes neuronales recurrentes analizando patrones temporales
738
+ </div>
739
+ </div>
740
+
741
+ <!-- On-Chain Analysis -->
742
+ <div class="method-card">
743
+ <div class="method-header">
744
+ <div class="method-title">Análisis On-Chain</div>
745
+ <span class="method-badge badge-yellow">Blockchain</span>
746
+ </div>
747
+ <div class="method-content">
748
+ <div class="method-row">
749
+ <span>Predicción:</span>
750
+ <span id="ocPrediction" class="method-value">$--</span>
751
+ </div>
752
+ <div class="method-row">
753
+ <span>Confianza:</span>
754
+ <span id="ocConfidence" class="method-value">--%</span>
755
+ </div>
756
+ <div class="method-row">
757
+ <span>Actividad red:</span>
758
+ <span id="ocActivity" class="method-value">--</span>
759
+ </div>
760
+ </div>
761
+ <div class="method-footer">
762
+ <i class="fas fa-info-circle"></i> Métricas de blockchain como transacciones y flujo de monedas
763
+ </div>
764
+ </div>
765
+
766
+ <!-- Elliott Waves -->
767
+ <div class="method-card">
768
+ <div class="method-header">
769
+ <div class="method-title">Ondas de Elliott</div>
770
+ <span class="method-badge badge-indigo">Patrones</span>
771
+ </div>
772
+ <div class="method-content">
773
+ <div class="method-row">
774
+ <span>Predicción:</span>
775
+ <span id="ewPrediction" class="method-value">$--</span>
776
+ </div>
777
+ <div class="method-row">
778
+ <span>Confianza:</span>
779
+ <span id="ewConfidence" class="method-value">--%</span>
780
+ </div>
781
+ <div class="method-row">
782
+ <span>Fase actual:</span>
783
+ <span id="ewPhase" class="method-value">--</span>
784
+ </div>
785
+ </div>
786
+ <div class="method-footer">
787
+ <i class="fas fa-info-circle"></i> Identificación de patrones cíclicos de impulso y corrección
788
+ </div>
789
+ </div>
790
+
791
+ <!-- Sentiment Analysis -->
792
+ <div class="method-card">
793
+ <div class="method-header">
794
+ <div class="method-title">Análisis de Sentimiento</div>
795
+ <span class="method-badge badge-pink">Redes Sociales</span>
796
+ </div>
797
+ <div class="method-content">
798
+ <div class="method-row">
799
+ <span>Predicción:</span>
800
+ <span id="saPrediction" class="method-value">$--</span>
801
+ </div>
802
+ <div class="method-row">
803
+ <span>Confianza:</span>
804
+ <span id="saConfidence" class="method-value">--%</span>
805
+ </div>
806
+ <div class="method-row">
807
+ <span>Sentimiento:</span>
808
+ <span id="saSentiment" class="method-value">--</span>
809
+ </div>
810
+ </div>
811
+ <div class="method-footer">
812
+ <i class="fas fa-info-circle"></i> Análisis de redes sociales, foros y noticias en tiempo real
813
+ </div>
814
+ </div>
815
+ </div>
816
+
817
+ <!-- Historical Predictions -->
818
+ <div class="history-container">
819
+ <div class="history-header">
820
+ <div class="history-title">Historial de Predicciones</div>
821
+ <button id="exportBtn" class="export-btn">
822
+ <i class="fas fa-download"></i> Exportar JSON
823
+ </button>
824
+ </div>
825
+ <div style="overflow-x: auto;">
826
+ <table class="history-table">
827
+ <thead>
828
+ <tr>
829
+ <th>Fecha</th>
830
+ <th>Predicción</th>
831
+ <th>Real</th>
832
+ <th>Diferencia</th>
833
+ <th>Precisión</th>
834
+ <th>Dirección</th>
835
+ <th>1h</th>
836
+ <th>8h</th>
837
+ <th>12h</th>
838
+ <th>24h</th>
839
+ </tr>
840
+ </thead>
841
+ <tbody id="historyTable">
842
+ <!-- Rows will be added dynamically -->
843
+ </tbody>
844
+ </table>
845
+ </div>
846
+ </div>
847
+
848
+ <!-- Settings -->
849
+ <div class="settings-container">
850
+ <h2 class="settings-title">Configuración</h2>
851
+ <div class="settings-grid">
852
+ <div class="settings-section">
853
+ <h3 class="section-title">Actualización Automática</h3>
854
+ <div class="auto-refresh">
855
+ <input type="checkbox" id="autoRefresh" checked>
856
+ <label for="autoRefresh">Actualizar cada 15 minutos</label>
857
+ </div>
858
+ <div class="next-refresh">
859
+ Próxima actualización: <span id="nextRefresh">--:--</span>
860
+ </div>
861
+ </div>
862
+ <div class="settings-section">
863
+ <h3 class="section-title">Ponderación de Modelos</h3>
864
+ <div style="font-size: 14px; color: #718096; margin-bottom: 15px;">
865
+ Ajusta la influencia de cada método en la predicción combinada
866
+ </div>
867
+ <div class="weight-control">
868
+ <div class="weight-label">Indicadores Técnicos</div>
869
+ <input type="range" min="0" max="100" value="25" class="weight-slider" id="tiWeight">
870
+ <div class="weight-value" id="tiWeightValue">25%</div>
871
+ </div>
872
+ <div class="weight-control">
873
+ <div class="weight-label">Aprendizaje Automático</div>
874
+ <input type="range" min="0" max="100" value="20" class="weight-slider" id="mlWeight">
875
+ <div class="weight-value" id="mlWeightValue">20%</div>
876
+ </div>
877
+ <div class="weight-control">
878
+ <div class="weight-label">Aprendizaje Profundo</div>
879
+ <input type="range" min="0" max="100" value="20" class="weight-slider" id="dlWeight">
880
+ <div class="weight-value" id="dlWeightValue">20%</div>
881
+ </div>
882
+ <div class="weight-control">
883
+ <div class="weight-label">Análisis On-Chain</div>
884
+ <input type="range" min="0" max="100" value="15" class="weight-slider" id="ocWeight">
885
+ <div class="weight-value" id="ocWeightValue">15%</div>
886
+ </div>
887
+ <div class="weight-control">
888
+ <div class="weight-label">Ondas de Elliott</div>
889
+ <input type="range" min="0" max="100" value="10" class="weight-slider" id="ewWeight">
890
+ <div class="weight-value" id="ewWeightValue">10%</div>
891
+ </div>
892
+ <div class="weight-control">
893
+ <div class="weight-label">Análisis Sentimiento</div>
894
+ <input type="range" min="0" max="100" value="10" class="weight-slider" id="saWeight">
895
+ <div class="weight-value" id="saWeightValue">10%</div>
896
+ </div>
897
+ </div>
898
+ </div>
899
+ </div>
900
+ </div>
901
+
902
+ <script>
903
+ // Global variables
904
+ let priceChart;
905
+ let accuracyGauge;
906
+ let autoRefreshInterval;
907
+ let nextRefreshTime;
908
+ let historicalData = [];
909
+ let predictionHistory = [];
910
+ let currentUser = null;
911
+ let activeTimeframe = '1h';
912
+
913
+ // Initialize the app when DOM is loaded
914
+ document.addEventListener('DOMContentLoaded', function() {
915
+ initializeSliders();
916
+ setupTimeframeTabs();
917
+ setupAutoRefresh();
918
+
919
+ // Check if user is already logged in
920
+ checkAuthState();
921
+
922
+ // Set up manual refresh button
923
+ document.getElementById('refreshBtn').addEventListener('click', function() {
924
+ fetchData();
925
+ });
926
+
927
+ // Set up export button
928
+ document.getElementById('exportBtn').addEventListener('click', exportHistory);
929
+ });
930
+
931
+ // Handle Google Sign-In response
932
+ function handleCredentialResponse(response) {
933
+ const credential = response.credential;
934
+ const decodedToken = parseJwt(credential);
935
+
936
+ currentUser = {
937
+ id: decodedToken.sub,
938
+ name: decodedToken.name,
939
+ email: decodedToken.email,
940
+ picture: decodedToken.picture
941
+ };
942
+
943
+ // Save user info to localStorage
944
+ localStorage.setItem('currentUser', JSON.stringify(currentUser));
945
+
946
+ // Update UI
947
+ updateUserUI();
948
+
949
+ // Load user's prediction history
950
+ loadUserHistory();
951
+
952
+ // Fetch data
953
+ fetchData();
954
+ }
955
+
956
+ // Parse JWT token
957
+ function parseJwt(token) {
958
+ const base64Url = token.split('.')[1];
959
+ const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
960
+ const jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
961
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
962
+ }).join(''));
963
+
964
+ return JSON.parse(jsonPayload);
965
+ }
966
+
967
+ // Check auth state on page load
968
+ function checkAuthState() {
969
+ const savedUser = localStorage.getItem('currentUser');
970
+ if (savedUser) {
971
+ currentUser = JSON.parse(savedUser);
972
+ updateUserUI();
973
+ loadUserHistory();
974
+ fetchData();
975
+ }
976
+ }
977
+
978
+ // Update UI with user info
979
+ function updateUserUI() {
980
+ const loginSection = document.getElementById('loginSection');
981
+ loginSection.innerHTML = '';
982
+
983
+ if (currentUser) {
984
+ const userInfo = document.createElement('div');
985
+ userInfo.className = 'user-info';
986
+
987
+ const avatar = document.createElement('img');
988
+ avatar.className = 'user-avatar';
989
+ avatar.src = currentUser.picture;
990
+ avatar.alt = currentUser.name;
991
+
992
+ const name = document.createElement('span');
993
+ name.className = 'user-name';
994
+ name.textContent = currentUser.name;
995
+
996
+ const logoutBtn = document.createElement('button');
997
+ logoutBtn.className = 'logout-btn';
998
+ logoutBtn.textContent = 'Cerrar sesión';
999
+ logoutBtn.addEventListener('click', logout);
1000
+
1001
+ userInfo.appendChild(avatar);
1002
+ userInfo.appendChild(name);
1003
+ userInfo.appendChild(logoutBtn);
1004
+
1005
+ loginSection.appendChild(userInfo);
1006
+ } else {
1007
+ // Show Google Sign-In button
1008
+ loginSection.innerHTML = `
1009
+ <div id="g_id_onload"
1010
+ data-client_id="YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com"
1011
+ data-callback="handleCredentialResponse"
1012
+ data-auto_prompt="false">
1013
+ </div>
1014
+ <div class="g_id_signin"
1015
+ data-type="standard"
1016
+ data-size="medium"
1017
+ data-theme="outline"
1018
+ data-text="sign_in_with"
1019
+ data-shape="rectangular"
1020
+ data-logo_alignment="left">
1021
+ </div>
1022
+ `;
1023
+
1024
+ // Reinitialize Google Sign-In button
1025
+ if (window.google) {
1026
+ google.accounts.id.initialize({
1027
+ client_id: 'YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com',
1028
+ callback: handleCredentialResponse
1029
+ });
1030
+ google.accounts.id.renderButton(
1031
+ document.querySelector('.g_id_signin'),
1032
+ { theme: "outline", size: "medium" }
1033
+ );
1034
+ }
1035
+ }
1036
+ }
1037
+
1038
+ // Logout function
1039
+ function logout() {
1040
+ localStorage.removeItem('currentUser');
1041
+ currentUser = null;
1042
+ predictionHistory = [];
1043
+ updateUserUI();
1044
+ renderHistoryTable();
1045
+
1046
+ // Clear the table
1047
+ document.getElementById('historyTable').innerHTML = '';
1048
+ }
1049
+
1050
+ // Load user's prediction history from localStorage
1051
+ function loadUserHistory() {
1052
+ if (!currentUser) return;
1053
+
1054
+ const userHistory = localStorage.getItem(`predictionHistory_${currentUser.id}`);
1055
+ if (userHistory) {
1056
+ predictionHistory = JSON.parse(userHistory);
1057
+ renderHistoryTable();
1058
+ updateAccuracyStats();
1059
+ }
1060
+ }
1061
+
1062
+ // Save user's prediction history to localStorage
1063
+ function saveUserHistory() {
1064
+ if (!currentUser) return;
1065
+ localStorage.setItem(`predictionHistory_${currentUser.id}`, JSON.stringify(predictionHistory));
1066
+ }
1067
+
1068
+ // Initialize the sliders for model weights
1069
+ function initializeSliders() {
1070
+ const sliders = ['ti', 'ml', 'dl', 'oc', 'ew', 'sa'];
1071
+ sliders.forEach(model => {
1072
+ const slider = document.getElementById(`${model}Weight`);
1073
+ const valueDisplay = document.getElementById(`${model}WeightValue`);
1074
+
1075
+ slider.addEventListener('input', function() {
1076
+ valueDisplay.textContent = `${this.value}%`;
1077
+ // Recalculate combined prediction if data is available
1078
+ if (historicalData.length > 0) {
1079
+ calculateCombinedPrediction();
1080
+ }
1081
+ });
1082
+ });
1083
+ }
1084
+
1085
+ // Set up timeframe tabs
1086
+ function setupTimeframeTabs() {
1087
+ const tabs = document.querySelectorAll('.timeframe-tab');
1088
+ tabs.forEach(tab => {
1089
+ tab.addEventListener('click', function() {
1090
+ // Remove active class from all tabs
1091
+ tabs.forEach(t => t.classList.remove('active'));
1092
+
1093
+ // Add active class to clicked tab
1094
+ this.classList.add('active');
1095
+
1096
+ // Update active timeframe
1097
+ activeTimeframe = this.dataset.timeframe;
1098
+
1099
+ // Update predictions for the selected timeframe
1100
+ updatePredictionsForTimeframe();
1101
+ });
1102
+ });
1103
+ }
1104
+
1105
+ // Update predictions display for selected timeframe
1106
+ function updatePredictionsForTimeframe() {
1107
+ if (predictionHistory.length === 0) return;
1108
+
1109
+ const latestPrediction = predictionHistory[0];
1110
+
1111
+ // Update combined prediction card
1112
+ const timeframeText = {
1113
+ '1h': 'Próxima hora',
1114
+ '8h': 'Próximas 8 horas',
1115
+ '12h': 'Próximas 12 horas',
1116
+ '24h': 'Próximas 24 horas'
1117
+ };
1118
+
1119
+ document.querySelector('.card-badge.badge-blue').textContent = timeframeText[activeTimeframe];
1120
+
1121
+ // Update combined prediction value
1122
+ const timeframePrediction = latestPrediction[`prediction_${activeTimeframe}`];
1123
+ const timeframeConfidence = latestPrediction[`confidence_${activeTimeframe}`];
1124
+ const timeframeDirection = latestPrediction[`direction_${activeTimeframe}`];
1125
+ const timeframeStrength = latestPrediction[`strength_${activeTimeframe}`];
1126
+
1127
+ document.getElementById('combinedPrediction').textContent = `$${timeframePrediction.toFixed(2)}`;
1128
+
1129
+ const confidenceElement = document.getElementById('combinedConfidence');
1130
+ const confidenceValue = confidenceElement.querySelector('.confidence-value');
1131
+ const confidenceText = confidenceElement.querySelector('.confidence-text');
1132
+
1133
+ confidenceValue.textContent = `${timeframeConfidence.toFixed(0)}%`;
1134
+ confidenceText.textContent = timeframeConfidence >= 70 ? 'Alta' :
1135
+ timeframeConfidence >= 50 ? 'Media' : 'Baja';
1136
+
1137
+ confidenceElement.className = `ml-2 text-sm flex items-center ${
1138
+ timeframeConfidence >= 70 ? 'text-green-500' :
1139
+ timeframeConfidence >= 50 ? 'text-yellow-500' : 'text-red-500'
1140
+ }`;
1141
+
1142
+ document.getElementById('predictionDirection').textContent = `Dirección: ${timeframeDirection}`;
1143
+ document.getElementById('predictionStrength').textContent = `Fuerza: ${timeframeStrength}`;
1144
+ }
1145
+
1146
+ // Fetch data from CoinGecko API
1147
+ async function fetchData() {
1148
+ if (!currentUser) {
1149
+ alert('Por favor inicia sesión con Google para usar la aplicación.');
1150
+ return;
1151
+ }
1152
+
1153
+ try {
1154
+ // Show loading state
1155
+ const refreshBtn = document.getElementById('refreshBtn');
1156
+ refreshBtn.disabled = true;
1157
+ refreshBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Actualizando...';
1158
+
1159
+ // Fetch price data for different timeframes
1160
+ const responses = await Promise.all([
1161
+ axios.get('https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1'),
1162
+ axios.get('https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=2'),
1163
+ axios.get('https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=7'),
1164
+ axios.get('https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=30')
1165
+ ]);
1166
+
1167
+ // Process data
1168
+ const [hourlyData, dailyData, weeklyData, monthlyData] = responses;
1169
+
1170
+ // Use hourly data for the chart
1171
+ historicalData = hourlyData.data.prices.map(item => ({
1172
+ timestamp: item[0],
1173
+ price: item[1]
1174
+ }));
1175
+
1176
+ // Update current price display
1177
+ const currentPrice = historicalData[historicalData.length - 1].price;
1178
+ const previousPrice = historicalData[historicalData.length - 2].price;
1179
+ const priceChange = ((currentPrice - previousPrice) / previousPrice) * 100;
1180
+
1181
+ document.getElementById('currentPrice').textContent = `$${currentPrice.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2})}`;
1182
+
1183
+ const changeElement = document.getElementById('priceChange');
1184
+ const arrowElement = changeElement.querySelector('.change-arrow');
1185
+ const percentElement = changeElement.querySelector('.change-percent');
1186
+
1187
+ if (priceChange >= 0) {
1188
+ changeElement.className = 'price-change price-up';
1189
+ arrowElement.innerHTML = '<i class="fas fa-caret-up"></i>';
1190
+ } else {
1191
+ changeElement.className = 'price-change price-down';
1192
+ arrowElement.innerHTML = '<i class="fas fa-caret-down"></i>';
1193
+ }
1194
+ percentElement.textContent = `${Math.abs(priceChange).toFixed(2)}%`;
1195
+
1196
+ // Update market cap and volume (using the latest data)
1197
+ document.getElementById('marketCap').textContent = `Capitalización: $${(hourlyData.data.market_caps[hourlyData.data.market_caps.length - 1][1]).toLocaleString('en-US', {minimumFractionDigits: 0, maximumFractionDigits: 0})}`;
1198
+ document.getElementById('volume').textContent = `Volumen: $${(hourlyData.data.total_volumes[hourlyData.data.total_volumes.length - 1][1]).toLocaleString('en-US', {minimumFractionDigits: 0, maximumFractionDigits: 0})}`;
1199
+
1200
+ // Generate predictions for all timeframes
1201
+ generatePredictions(currentPrice);
1202
+
1203
+ // Update chart with EMA 20 and EMA 50
1204
+ updateChart();
1205
+
1206
+ // Update last updated time
1207
+ const now = new Date();
1208
+ document.getElementById('lastUpdated').textContent = `Última actualización: ${now.toLocaleTimeString()}`;
1209
+
1210
+ // Schedule next refresh
1211
+ scheduleNextRefresh();
1212
+
1213
+ // Update past predictions with actual prices
1214
+ updatePastPredictions(currentPrice);
1215
+
1216
+ } catch (error) {
1217
+ console.error('Error fetching data:', error);
1218
+ alert('Error al obtener datos. Por favor intenta nuevamente.');
1219
+ } finally {
1220
+ // Reset button state
1221
+ const refreshBtn = document.getElementById('refreshBtn');
1222
+ refreshBtn.disabled = false;
1223
+ refreshBtn.innerHTML = '<i class="fas fa-sync-alt"></i> Actualizar';
1224
+ }
1225
+ }
1226
+
1227
+ // Generate predictions using different methods for all timeframes
1228
+ function generatePredictions(currentPrice) {
1229
+ // Generate predictions for all timeframes
1230
+ const timeframes = ['1h', '8h', '12h', '24h'];
1231
+ const predictions = {};
1232
+
1233
+ timeframes.forEach(timeframe => {
1234
+ // Technical Indicators Prediction
1235
+ const tiPrediction = currentPrice * (1 + (Math.random() * 0.02 - 0.01)); // Random variation around current price
1236
+ const tiConfidence = 70 + Math.random() * 20; // 70-90% confidence
1237
+ const tiDirection = tiPrediction > currentPrice ? 'Alcista' : 'Bajista';
1238
+
1239
+ // Machine Learning Prediction
1240
+ const mlPrediction = currentPrice * (1 + (Math.random() * 0.03 - 0.015));
1241
+ const mlConfidence = 65 + Math.random() * 25;
1242
+ const mlAccuracy = 75 + Math.random() * 15;
1243
+
1244
+ // Deep Learning Prediction
1245
+ const dlPrediction = currentPrice * (1 + (Math.random() * 0.025 - 0.0125));
1246
+ const dlConfidence = 75 + Math.random() * 20;
1247
+ const dlAccuracy = 80 + Math.random() * 15;
1248
+
1249
+ // On-Chain Analysis
1250
+ const ocPrediction = currentPrice * (1 + (Math.random() * 0.015 - 0.0075));
1251
+ const ocConfidence = 60 + Math.random() * 30;
1252
+ const ocActivity = ['Baja', 'Media', 'Alta'][Math.floor(Math.random() * 3)];
1253
+
1254
+ // Elliott Waves
1255
+ const ewPrediction = currentPrice * (1 + (Math.random() * 0.02 - 0.01));
1256
+ const ewConfidence = 50 + Math.random() * 40;
1257
+ const ewPhase = ['Impulso 1', 'Corrección A', 'Impulso 3', 'Corrección B', 'Impulso 5'][Math.floor(Math.random() * 5)];
1258
+
1259
+ // Sentiment Analysis
1260
+ const saPrediction = currentPrice * (1 + (Math.random() * 0.025 - 0.0125));
1261
+ const saConfidence = 55 + Math.random() * 35;
1262
+ const saSentiment = ['Negativo', 'Neutral', 'Positivo'][Math.floor(Math.random() * 3)];
1263
+
1264
+ // Calculate combined prediction for this timeframe
1265
+ const combined = calculateCombinedPredictionForTimeframe(
1266
+ currentPrice,
1267
+ { prediction: tiPrediction, confidence: tiConfidence },
1268
+ { prediction: mlPrediction, confidence: mlConfidence },
1269
+ { prediction: dlPrediction, confidence: dlConfidence },
1270
+ { prediction: ocPrediction, confidence: ocConfidence },
1271
+ { prediction: ewPrediction, confidence: ewConfidence },
1272
+ { prediction: saPrediction, confidence: saConfidence }
1273
+ );
1274
+
1275
+ predictions[timeframe] = combined;
1276
+
1277
+ // For the 1h timeframe, update the method cards
1278
+ if (timeframe === '1h') {
1279
+ document.getElementById('tiPrediction').textContent = `$${tiPrediction.toFixed(2)}`;
1280
+ document.getElementById('tiConfidence').textContent = `${tiConfidence.toFixed(0)}%`;
1281
+ document.getElementById('tiDirection').textContent = tiDirection;
1282
+
1283
+ document.getElementById('mlPrediction').textContent = `$${mlPrediction.toFixed(2)}`;
1284
+ document.getElementById('mlConfidence').textContent = `${mlConfidence.toFixed(0)}%`;
1285
+ document.getElementById('mlAccuracy').textContent = `${mlAccuracy.toFixed(0)}%`;
1286
+
1287
+ document.getElementById('dlPrediction').textContent = `$${dlPrediction.toFixed(2)}`;
1288
+ document.getElementById('dlConfidence').textContent = `${dlConfidence.toFixed(0)}%`;
1289
+ document.getElementById('dlAccuracy').textContent = `${dlAccuracy.toFixed(0)}%`;
1290
+
1291
+ document.getElementById('ocPrediction').textContent = `$${ocPrediction.toFixed(2)}`;
1292
+ document.getElementById('ocConfidence').textContent = `${ocConfidence.toFixed(0)}%`;
1293
+ document.getElementById('ocActivity').textContent = ocActivity;
1294
+
1295
+ document.getElementById('ewPrediction').textContent = `$${ewPrediction.toFixed(2)}`;
1296
+ document.getElementById('ewConfidence').textContent = `${ewConfidence.toFixed(0)}%`;
1297
+ document.getElementById('ewPhase').textContent = ewPhase;
1298
+
1299
+ document.getElementById('saPrediction').textContent = `$${saPrediction.toFixed(2)}`;
1300
+ document.getElementById('saConfidence').textContent = `${saConfidence.toFixed(0)}%`;
1301
+ document.getElementById('saSentiment').textContent = saSentiment;
1302
+ }
1303
+ });
1304
+
1305
+ // Save prediction to history
1306
+ savePredictionToHistory(currentPrice, predictions);
1307
+
1308
+ // Update the display for the active timeframe
1309
+ updatePredictionsForTimeframe();
1310
+ }
1311
+
1312
+ // Calculate combined prediction for a specific timeframe
1313
+ function calculateCombinedPredictionForTimeframe(
1314
+ currentPrice,
1315
+ ti, ml, dl, oc, ew, sa
1316
+ ) {
1317
+ // Get weights from sliders
1318
+ const tiWeight = parseInt(document.getElementById('tiWeight').value) / 100;
1319
+ const mlWeight = parseInt(document.getElementById('mlWeight').value) / 100;
1320
+ const dlWeight = parseInt(document.getElementById('dlWeight').value) / 100;
1321
+ const ocWeight = parseInt(document.getElementById('ocWeight').value) / 100;
1322
+ const ewWeight = parseInt(document.getElementById('ewWeight').value) / 100;
1323
+ const saWeight = parseInt(document.getElementById('saWeight').value) / 100;
1324
+
1325
+ // Calculate weighted average
1326
+ const totalWeight = tiWeight + mlWeight + dlWeight + ocWeight + ewWeight + saWeight;
1327
+
1328
+ const combinedPrediction = (
1329
+ (ti.prediction * tiWeight * ti.confidence) +
1330
+ (ml.prediction * mlWeight * ml.confidence) +
1331
+ (dl.prediction * dlWeight * dl.confidence) +
1332
+ (oc.prediction * ocWeight * oc.confidence) +
1333
+ (ew.prediction * ewWeight * ew.confidence) +
1334
+ (sa.prediction * saWeight * sa.confidence)
1335
+ ) / (
1336
+ (tiWeight * ti.confidence) +
1337
+ (mlWeight * ml.confidence) +
1338
+ (dlWeight * dl.confidence) +
1339
+ (ocWeight * oc.confidence) +
1340
+ (ewWeight * ew.confidence) +
1341
+ (saWeight * sa.confidence)
1342
+ );
1343
+
1344
+ // Calculate combined confidence (weighted average)
1345
+ const combinedConfidence = (
1346
+ (ti.confidence * tiWeight) +
1347
+ (ml.confidence * mlWeight) +
1348
+ (dl.confidence * dlWeight) +
1349
+ (oc.confidence * ocWeight) +
1350
+ (ew.confidence * ewWeight) +
1351
+ (sa.confidence * saWeight)
1352
+ ) / totalWeight;
1353
+
1354
+ // Determine direction and strength
1355
+ const direction = combinedPrediction > currentPrice ? 'Alcista' : 'Bajista';
1356
+ const strength = Math.abs((combinedPrediction - currentPrice) / currentPrice * 100);
1357
+ let strengthText;
1358
+
1359
+ if (strength < 0.5) strengthText = 'Débil';
1360
+ else if (strength < 1.5) strengthText = 'Moderada';
1361
+ else strengthText = 'Fuerte';
1362
+
1363
+ return {
1364
+ prediction: combinedPrediction,
1365
+ confidence: combinedConfidence * 100,
1366
+ direction: direction,
1367
+ strength: strengthText
1368
+ };
1369
+ }
1370
+
1371
+ // Save prediction to history
1372
+ function savePredictionToHistory(currentPrice, predictions) {
1373
+ const now = new Date();
1374
+
1375
+ // Create new prediction entry
1376
+ const newPrediction = {
1377
+ timestamp: now.getTime(),
1378
+ date: now.toISOString(),
1379
+ currentPrice: currentPrice,
1380
+ prediction_1h: predictions['1h'].prediction,
1381
+ confidence_1h: predictions['1h'].confidence,
1382
+ direction_1h: predictions['1h'].direction,
1383
+ strength_1h: predictions['1h'].strength,
1384
+ prediction_8h: predictions['8h'].prediction,
1385
+ confidence_8h: predictions['8h'].confidence,
1386
+ direction_8h: predictions['8h'].direction,
1387
+ strength_8h: predictions['8h'].strength,
1388
+ prediction_12h: predictions['12h'].prediction,
1389
+ confidence_12h: predictions['12h'].confidence,
1390
+ direction_12h: predictions['12h'].direction,
1391
+ strength_12h: predictions['12h'].strength,
1392
+ prediction_24h: predictions['24h'].prediction,
1393
+ confidence_24h: predictions['24h'].confidence,
1394
+ direction_24h: predictions['24h'].direction,
1395
+ strength_24h: predictions['24h'].strength,
1396
+ actualPrice_1h: null,
1397
+ actualPrice_8h: null,
1398
+ actualPrice_12h: null,
1399
+ actualPrice_24h: null,
1400
+ accuracy_1h: null,
1401
+ accuracy_8h: null,
1402
+ accuracy_12h: null,
1403
+ accuracy_24h: null,
1404
+ directionCorrect_1h: null,
1405
+ directionCorrect_8h: null,
1406
+ directionCorrect_12h: null,
1407
+ directionCorrect_24h: null
1408
+ };
1409
+
1410
+ // Add to history
1411
+ predictionHistory.unshift(newPrediction);
1412
+
1413
+ // Keep only the last 100 predictions
1414
+ if (predictionHistory.length > 100) {
1415
+ predictionHistory = predictionHistory.slice(0, 100);
1416
+ }
1417
+
1418
+ // Save to localStorage
1419
+ saveUserHistory();
1420
+
1421
+ // Update history table
1422
+ renderHistoryTable();
1423
+ }
1424
+
1425
+ // Update actual prices for past predictions
1426
+ function updatePastPredictions(currentPrice) {
1427
+ const now = new Date();
1428
+
1429
+ // Update predictions with actual prices after the timeframe has passed
1430
+ let updated = false;
1431
+
1432
+ predictionHistory.forEach(prediction => {
1433
+ const predictionTime = new Date(prediction.timestamp);
1434
+ const timePassed = now.getTime() - prediction.timestamp;
1435
+
1436
+ // Check if 1 hour has passed
1437
+ if (timePassed >= 60 * 60 * 1000 && prediction.actualPrice_1h === null) {
1438
+ prediction.actualPrice_1h = currentPrice;
1439
+ updated = true;
1440
+
1441
+ // Calculate accuracy
1442
+ const priceDifference = Math.abs(prediction.prediction_1h - prediction.actualPrice_1h);
1443
+ const accuracy = 100 - (priceDifference / prediction.actualPrice_1h * 100);
1444
+ prediction.accuracy_1h = Math.max(0, Math.min(100, accuracy)); // Clamp between 0-100
1445
+
1446
+ // Determine if direction was correct
1447
+ const predictedDirection = prediction.direction_1h === 'Alcista' ? 1 : -1;
1448
+ const actualDirection = prediction.actualPrice_1h > prediction.currentPrice ? 1 : -1;
1449
+ prediction.directionCorrect_1h = predictedDirection === actualDirection;
1450
+ }
1451
+
1452
+ // Check if 8 hours have passed
1453
+ if (timePassed >= 8 * 60 * 60 * 1000 && prediction.actualPrice_8h === null) {
1454
+ prediction.actualPrice_8h = currentPrice;
1455
+ updated = true;
1456
+
1457
+ const priceDifference = Math.abs(prediction.prediction_8h - prediction.actualPrice_8h);
1458
+ const accuracy = 100 - (priceDifference / prediction.actualPrice_8h * 100);
1459
+ prediction.accuracy_8h = Math.max(0, Math.min(100, accuracy));
1460
+
1461
+ const predictedDirection = prediction.direction_8h === 'Alcista' ? 1 : -1;
1462
+ const actualDirection = prediction.actualPrice_8h > prediction.currentPrice ? 1 : -1;
1463
+ prediction.directionCorrect_8h = predictedDirection === actualDirection;
1464
+ }
1465
+
1466
+ // Check if 12 hours have passed
1467
+ if (timePassed >= 12 * 60 * 60 * 1000 && prediction.actualPrice_12h === null) {
1468
+ prediction.actualPrice_12h = currentPrice;
1469
+ updated = true;
1470
+
1471
+ const priceDifference = Math.abs(prediction.prediction_12h - prediction.actualPrice_12h);
1472
+ const accuracy = 100 - (priceDifference / prediction.actualPrice_12h * 100);
1473
+ prediction.accuracy_12h = Math.max(0, Math.min(100, accuracy));
1474
+
1475
+ const predictedDirection = prediction.direction_12h === 'Alcista' ? 1 : -1;
1476
+ const actualDirection = prediction.actualPrice_12h > prediction.currentPrice ? 1 : -1;
1477
+ prediction.directionCorrect_12h = predictedDirection === actualDirection;
1478
+ }
1479
+
1480
+ // Check if 24 hours have passed
1481
+ if (timePassed >= 24 * 60 * 60 * 1000 && prediction.actualPrice_24h === null) {
1482
+ prediction.actualPrice_24h = currentPrice;
1483
+ updated = true;
1484
+
1485
+ const priceDifference = Math.abs(prediction.prediction_24h - prediction.actualPrice_24h);
1486
+ const accuracy = 100 - (priceDifference / prediction.actualPrice_24h * 100);
1487
+ prediction.accuracy_24h = Math.max(0, Math.min(100, accuracy));
1488
+
1489
+ const predictedDirection = prediction.direction_24h === 'Alcista' ? 1 : -1;
1490
+ const actualDirection = prediction.actualPrice_24h > prediction.currentPrice ? 1 : -1;
1491
+ prediction.directionCorrect_24h = predictedDirection === actualDirection;
1492
+ }
1493
+ });
1494
+
1495
+ if (updated) {
1496
+ // Save updated history
1497
+ saveUserHistory();
1498
+
1499
+ // Update UI
1500
+ renderHistoryTable();
1501
+ updateAccuracyStats();
1502
+ }
1503
+ }
1504
+
1505
+ // Render history table
1506
+ function renderHistoryTable() {
1507
+ const tableBody = document.getElementById('historyTable');
1508
+ tableBody.innerHTML = '';
1509
+
1510
+ predictionHistory.forEach((prediction, index) => {
1511
+ const row = document.createElement('tr');
1512
+
1513
+ // Date column
1514
+ const dateCell = document.createElement('td');
1515
+ dateCell.textContent = new Date(prediction.timestamp).toLocaleString();
1516
+
1517
+ // Prediction column (shows prediction for active timeframe)
1518
+ const predictionCell = document.createElement('td');
1519
+ predictionCell.textContent = `$${prediction[`prediction_${activeTimeframe}`].toFixed(2)}`;
1520
+
1521
+ // Actual price column
1522
+ const actualCell = document.createElement('td');
1523
+ const actualPrice = prediction[`actualPrice_${activeTimeframe}`];
1524
+ if (actualPrice !== null) {
1525
+ actualCell.textContent = `$${actualPrice.toFixed(2)}`;
1526
+ } else {
1527
+ actualCell.textContent = '--';
1528
+ }
1529
+
1530
+ // Difference column
1531
+ const differenceCell = document.createElement('td');
1532
+ if (actualPrice !== null) {
1533
+ const difference = actualPrice - prediction[`prediction_${activeTimeframe}`];
1534
+ const absDifference = Math.abs(difference);
1535
+ const differenceText = `$${absDifference.toFixed(2)} (${(absDifference / prediction[`prediction_${activeTimeframe}`] * 100).toFixed(2)}%)`;
1536
+
1537
+ if (difference > 0) {
1538
+ differenceCell.innerHTML = `<span style="color: #38a169;">+${differenceText}</span>`;
1539
+ } else if (difference < 0) {
1540
+ differenceCell.innerHTML = `<span style="color: #e53e3e;">-${differenceText}</span>`;
1541
+ } else {
1542
+ differenceCell.textContent = differenceText;
1543
+ }
1544
+ } else {
1545
+ differenceCell.textContent = '--';
1546
+ }
1547
+
1548
+ // Accuracy column
1549
+ const accuracyCell = document.createElement('td');
1550
+ const accuracy = prediction[`accuracy_${activeTimeframe}`];
1551
+ if (accuracy !== null) {
1552
+ const accuracyText = `${accuracy.toFixed(1)}%`;
1553
+
1554
+ if (accuracy >= 90) {
1555
+ accuracyCell.innerHTML = `<span style="color: #38a169;">${accuracyText}</span>`;
1556
+ } else if (accuracy >= 70) {
1557
+ accuracyCell.innerHTML = `<span style="color: #d69e2e;">${accuracyText}</span>`;
1558
+ } else {
1559
+ accuracyCell.innerHTML = `<span style="color: #e53e3e;">${accuracyText}</span>`;
1560
+ }
1561
+ } else {
1562
+ accuracyCell.textContent = '--';
1563
+ }
1564
+
1565
+ // Direction column
1566
+ const directionCell = document.createElement('td');
1567
+ const directionCorrect = prediction[`directionCorrect_${activeTimeframe}`];
1568
+ if (directionCorrect !== null) {
1569
+ if (directionCorrect) {
1570
+ directionCell.innerHTML = `<span style="color: #38a169;">Correcta</span>`;
1571
+ } else {
1572
+ directionCell.innerHTML = `<span style="color: #e53e3e;">Incorrecta</span>`;
1573
+ }
1574
+ } else {
1575
+ directionCell.textContent = '--';
1576
+ }
1577
+
1578
+ // Timeframe predictions (1h, 8h, 12h, 24h)
1579
+ const timeframes = ['1h', '8h', '12h', '24h'];
1580
+ timeframes.forEach(tf => {
1581
+ const tfCell = document.createElement('td');
1582
+ const actualPrice = prediction[`actualPrice_${tf}`];
1583
+
1584
+ if (actualPrice !== null) {
1585
+ const difference = actualPrice - prediction[`prediction_${tf}`];
1586
+ const color = difference >= 0 ? '#38a169' : '#e53e3e';
1587
+ const symbol = difference >= 0 ? '▲' : '▼';
1588
+
1589
+ tfCell.innerHTML = `
1590
+ <div style="color: ${color}; font-weight: 500;">
1591
+ ${symbol} $${actualPrice.toFixed(2)}
1592
+ </div>
1593
+ <div style="font-size: 12px; color: #718096;">
1594
+ ${prediction[`accuracy_${tf}`].toFixed(1)}%
1595
+ </div>
1596
+ `;
1597
+ } else {
1598
+ tfCell.innerHTML = `
1599
+ <div style="font-weight: 500;">
1600
+ $${prediction[`prediction_${tf}`].toFixed(2)}
1601
+ </div>
1602
+ <div style="font-size: 12px; color: #718096;">
1603
+ --
1604
+ </div>
1605
+ `;
1606
+ }
1607
+
1608
+ row.appendChild(tfCell);
1609
+ });
1610
+
1611
+ // Add all cells to row
1612
+ row.appendChild(dateCell);
1613
+ row.appendChild(predictionCell);
1614
+ row.appendChild(actualCell);
1615
+ row.appendChild(differenceCell);
1616
+ row.appendChild(accuracyCell);
1617
+ row.appendChild(directionCell);
1618
+
1619
+ tableBody.appendChild(row);
1620
+ });
1621
+ }
1622
+
1623
+ // Update accuracy statistics
1624
+ function updateAccuracyStats() {
1625
+ const completedPredictions = predictionHistory.filter(p =>
1626
+ p[`accuracy_${activeTimeframe}`] !== null
1627
+ );
1628
+
1629
+ if (completedPredictions.length > 0) {
1630
+ const totalAccuracy = completedPredictions.reduce(
1631
+ (sum, p) => sum + p[`accuracy_${activeTimeframe}`], 0
1632
+ );
1633
+ const avgAccuracy = totalAccuracy / completedPredictions.length;
1634
+
1635
+ const correctDirections = completedPredictions.filter(
1636
+ p => p[`directionCorrect_${activeTimeframe}`]
1637
+ ).length;
1638
+
1639
+ document.getElementById('avgAccuracy').textContent = `${avgAccuracy.toFixed(1)}%`;
1640
+ document.getElementById('correctPredictions').textContent = `${correctDirections}/${completedPredictions.length}`;
1641
+
1642
+ // Update accuracy gauge
1643
+ updateAccuracyGauge(avgAccuracy);
1644
+ }
1645
+ }
1646
+
1647
+ // Update accuracy gauge chart
1648
+ function updateAccuracyGauge(accuracy) {
1649
+ if (!accuracyGauge) {
1650
+ const ctx = document.getElementById('accuracyGauge').getContext('2d');
1651
+
1652
+ accuracyGauge = new Chart(ctx, {
1653
+ type: 'doughnut',
1654
+ data: {
1655
+ datasets: [{
1656
+ data: [accuracy, 100 - accuracy],
1657
+ backgroundColor: [
1658
+ getAccuracyColor(accuracy),
1659
+ '#f3f4f6'
1660
+ ],
1661
+ borderWidth: 0
1662
+ }]
1663
+ },
1664
+ options: {
1665
+ cutout: '80%',
1666
+ rotation: -90,
1667
+ circumference: 180,
1668
+ plugins: {
1669
+ legend: {
1670
+ display: false
1671
+ },
1672
+ tooltip: {
1673
+ enabled: false
1674
+ }
1675
+ }
1676
+ }
1677
+ });
1678
+ } else {
1679
+ accuracyGauge.data.datasets[0].data = [accuracy, 100 - accuracy];
1680
+ accuracyGauge.data.datasets[0].backgroundColor[0] = getAccuracyColor(accuracy);
1681
+ accuracyGauge.update();
1682
+ }
1683
+ }
1684
+
1685
+ // Get color based on accuracy
1686
+ function getAccuracyColor(accuracy) {
1687
+ if (accuracy >= 80) return '#38a169'; // green
1688
+ if (accuracy >= 60) return '#d69e2e'; // yellow
1689
+ return '#e53e3e'; // red
1690
+ }
1691
+
1692
+ // Update price chart with EMA 20 and EMA 50
1693
+ function updateChart() {
1694
+ const ctx = document.getElementById('priceChart').getContext('2d');
1695
+
1696
+ // Prepare data for chart
1697
+ const labels = historicalData.map(item => new Date(item.timestamp));
1698
+ const prices = historicalData.map(item => item.price);
1699
+
1700
+ // Calculate EMA (Exponential Moving Average) functions
1701
+ function calculateEMA(data, period) {
1702
+ const k = 2 / (period + 1);
1703
+ const ema = [];
1704
+ let sum = 0;
1705
+
1706
+ // Simple moving average for first period values
1707
+ for (let i = 0; i < period; i++) {
1708
+ sum += data[i];
1709
+ ema.push(null);
1710
+ }
1711
+
1712
+ // First EMA value is the SMA
1713
+ ema[period - 1] = sum / period;
1714
+
1715
+ // Calculate EMA for remaining values
1716
+ for (let i = period; i < data.length; i++) {
1717
+ ema[i] = data[i] * k + ema[i - 1] * (1 - k);
1718
+ }
1719
+
1720
+ return ema;
1721
+ }
1722
+
1723
+ // Calculate EMAs
1724
+ const ema20 = calculateEMA(prices, 20);
1725
+ const ema50 = calculateEMA(prices, 50);
1726
+
1727
+ // Create or update chart
1728
+ if (!priceChart) {
1729
+ priceChart = new Chart(ctx, {
1730
+ type: 'line',
1731
+ data: {
1732
+ labels: labels,
1733
+ datasets: [
1734
+ {
1735
+ label: 'Precio BTC',
1736
+ data: prices,
1737
+ borderColor: '#3182ce',
1738
+ backgroundColor: 'rgba(49, 130, 206, 0.05)',
1739
+ borderWidth: 2,
1740
+ fill: true,
1741
+ tension: 0.4
1742
+ },
1743
+ {
1744
+ label: 'EMA 20',
1745
+ data: ema20,
1746
+ borderColor: '#d69e2e',
1747
+ borderWidth: 1.5,
1748
+ pointRadius: 0,
1749
+ tension: 0.4
1750
+ },
1751
+ {
1752
+ label: 'EMA 50',
1753
+ data: ema50,
1754
+ borderColor: '#805ad5',
1755
+ borderWidth: 1.5,
1756
+ pointRadius: 0,
1757
+ tension: 0.4
1758
+ }
1759
+ ]
1760
+ },
1761
+ options: {
1762
+ responsive: true,
1763
+ maintainAspectRatio: false,
1764
+ scales: {
1765
+ x: {
1766
+ type: 'time',
1767
+ time: {
1768
+ unit: 'hour',
1769
+ displayFormats: {
1770
+ hour: 'HH:mm'
1771
+ }
1772
+ },
1773
+ grid: {
1774
+ display: false
1775
+ }
1776
+ },
1777
+ y: {
1778
+ beginAtZero: false,
1779
+ grid: {
1780
+ color: 'rgba(0, 0, 0, 0.05)'
1781
+ },
1782
+ ticks: {
1783
+ callback: function(value) {
1784
+ return '$' + value.toLocaleString();
1785
+ }
1786
+ }
1787
+ }
1788
+ },
1789
+ plugins: {
1790
+ tooltip: {
1791
+ mode: 'index',
1792
+ intersect: false,
1793
+ callbacks: {
1794
+ label: function(context) {
1795
+ let label = context.dataset.label || '';
1796
+ if (label) {
1797
+ label += ': ';
1798
+ }
1799
+ if (context.parsed.y !== null) {
1800
+ label += '$' + context.parsed.y.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
1801
+ }
1802
+ return label;
1803
+ }
1804
+ }
1805
+ },
1806
+ legend: {
1807
+ position: 'top',
1808
+ align: 'end'
1809
+ }
1810
+ },
1811
+ interaction: {
1812
+ mode: 'nearest',
1813
+ axis: 'x',
1814
+ intersect: false
1815
+ }
1816
+ }
1817
+ });
1818
+ } else {
1819
+ priceChart.data.labels = labels;
1820
+ priceChart.data.datasets[0].data = prices;
1821
+ priceChart.data.datasets[1].data = ema20;
1822
+ priceChart.data.datasets[2].data = ema50;
1823
+ priceChart.update();
1824
+ }
1825
+ }
1826
+
1827
+ // Set up auto-refresh
1828
+ function setupAutoRefresh() {
1829
+ const autoRefreshCheckbox = document.getElementById('autoRefresh');
1830
+
1831
+ autoRefreshCheckbox.addEventListener('change', function() {
1832
+ if (this.checked) {
1833
+ scheduleNextRefresh();
1834
+ } else {
1835
+ clearTimeout(autoRefreshInterval);
1836
+ document.getElementById('nextRefresh').textContent = '--:--';
1837
+ }
1838
+ });
1839
+
1840
+ // Initial schedule
1841
+ if (autoRefreshCheckbox.checked) {
1842
+ scheduleNextRefresh();
1843
+ }
1844
+ }
1845
+
1846
+ // Schedule next refresh
1847
+ function scheduleNextRefresh() {
1848
+ clearTimeout(autoRefreshInterval);
1849
+
1850
+ const now = new Date();
1851
+ const nextRefresh = new Date(now.getTime() + 15 * 60 * 1000); // 15 minutes from now
1852
+
1853
+ document.getElementById('nextRefresh').textContent = nextRefresh.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
1854
+
1855
+ autoRefreshInterval = setTimeout(() => {
1856
+ fetchData();
1857
+
1858
+ if (document.getElementById('autoRefresh').checked) {
1859
+ scheduleNextRefresh();
1860
+ }
1861
+ }, 15 * 60 * 1000);
1862
+ }
1863
+
1864
+ // Export history as JSON
1865
+ function exportHistory() {
1866
+ if (!currentUser) {
1867
+ alert('Por favor inicia sesión para exportar tu historial.');
1868
+ return;
1869
+ }
1870
+
1871
+ const dataStr = JSON.stringify(predictionHistory, null, 2);
1872
+ const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
1873
+
1874
+ const exportFileDefaultName = `bitcoin-predictions-${currentUser.id}-${new Date().toISOString().slice(0, 10)}.json`;
1875
+
1876
+ const linkElement = document.createElement('a');
1877
+ linkElement.setAttribute('href', dataUri);
1878
+ linkElement.setAttribute('download', exportFileDefaultName);
1879
+ linkElement.click();
1880
+ }
1881
+ </script>
1882
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=note6/btcpromulti" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1883
+ </html>
prompts.txt ADDED
File without changes