-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
685 lines (557 loc) · 32.7 KB
/
index.html
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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
<!DOCTYPE html>
<html>
<head>
<title>Stock Price Prediction</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" crossorigin="anonymous">
</script>
<!--<script src="node_modules/technicalindicators/dist/browser.es6.js"></script>-->
<!-- Import TensorFlow.js -->
<!--<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.0.0/dist/tf.min.js"></script>-->
<!-- Import tfjs-vis -->
<!--<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-vis@1.0.2/dist/tfjs-vis.umd.min.js"></script>-->
<script src="/socket.io/socket.io.js"></script>
<!-- Import the main script file -->
<!--<script src="script.js"></script>-->
<style>
label {
font-weight: bold;
}
</style>
</head>
<body>
<div class="container-lg">
<!--<h2>Look at the console to see progresses</h2>
<h3>(F12 o Dev Tools)</h3>
<h4>Forex Best Indicators: Trend, Momentum, Volatility, Volume</h4>-->
<header>
<!-- Navbar -->
<!--<nav class="navbar navbar-expand-lg navbar-light bg-white">
<div class="container-fluid">
<button
class="navbar-toggler"
type="button"
data-mdb-toggle="collapse"
data-mdb-target="#navbarExample01"
aria-controls="navbarExample01"
aria-expanded="false"
aria-label="Toggle navigation"
>
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarExample01">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item active">
<a class="nav-link" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
</ul>
</div>
</div>
</nav>-->
<!-- Navbar -->
<br>
<!-- Background image -->
<div class="p-0 text-center bg-image" style="
background-size: cover;
background-image: url('banner');
height: 20vh;
background-repeat: round;
">
<div class="mask" style="background-color: rgb(0 0 0 / 35%);height:100%;">
<div class="d-flex justify-content-center align-items-center h-100">
<div class="text-white">
<h1 class="mb-3">ForexAIForecast</h1>
<h4 class="mb-3">Artificial Intelligence<br>to Invest Better</h4>
<!--<a class="btn btn-outline-light btn-lg" href="#!" role="button"
>Call to action</a
>-->
</div>
</div>
</div>
</div>
<!-- Background image -->
</header>
<br>
<label>Market Name</label>
<!--onchange="fillCurrencyPairs(this.value)" -->
<select class="form-control" id="market_name">
<option value="CRYPTO">CRYPTO</option>
<!--<option value="FOREX">FOREX</option>-->
</select>
<br>
<label>Currency Pair 1</label>
<select class="form-control" id="currency_pair_1">
<!--<option>EUR</option>-->
<option>BTC</option>
<option>ETH</option>
<!--<option>DOGE</option>
<!--<option>SOL</option> TROPPO POCHI DATI
<option>SHIB</option>TROPPO POCHI DATI-->
</select>
<br>
<label>Currency Pair 2</label>
<select class="form-control" id="currency_pair_2">
<option>USD</option>
<!--<option>GBP</option>-->
<!--<option>USD</option>-->
</select>
<br>
<label>Time Interval (default 1 Day)</label>
<select class="form-control" id="time_interval">
<option value="INTRADAY_1_MIN">1 MIN (DA TESTARE)</option>
<option value="INTRADAY_5_MIN">5 MIN (DA TESTARE)</option>
<option value="INTRADAY_15_MIN">15 MIN (DA TESTARE)</option>
<option value="INTRADAY_30_MIN">30 MIN (DA TESTARE)</option>-->
<option value="INTRADAY_60_MIN">60 MIN</option>
<option value="DAILY" selected>1 DAY</option>
<!--<option value="WEEKLY">1 WEEK</option>
<option value="MONTHLY">1 MONTH</option>-->
</select>
<br>
<label style="display:none;">Time Steps (default 14)</label>
<input class="form-control" id="time_steps" value="14" placeholder="Daily Time Steps default 14" style="display:none;">
<!--<br>-->
<!--<label style="display:none;">Epochs Number (default 10)</label>
<input class="form-control" id="epochs_number" value="50" placeholder="Daily Epochs Number default 15"
style="display:none;">
<!--<br>-->
<button class="btn btn-success" id="train-button">PREDICT</button>
<button class="btn btn-success" id="auto-one-minute-button">AUTO INVEST (1 MINUTE)</button>
<button class="btn btn-success" id="auto-five-minutes-button">AUTO INVEST (5 MINUTES)</button>
<button class="btn btn-success" id="clear-auto-investment-button" style="display:none;">CLEAR AUTO INVESTMENT</button>
<!--<button class="btn btn-success" id="predict-button" style="display:none;">ONLY PREDICT (AFTER TRAINING)</button>-->
<br>
<!--<br>
<textarea class="form-control" id="trainingAccuracy" placeholder="Training Accuracy"></textarea>-->
<br>
<!--<textarea class="form-control" id="finalResult" rows="10" placeholder="Results"></textarea>-->
<label for="basic-url">RESULTS</label>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Last Closed Price</span>
</div>
<input type="text" class="form-control" id="last_price" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Negotiation Advice</span>
</div>
<input type="text" class="form-control" id="advice" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Reccom. Take Profit</span>
</div>
<input type="text" class="form-control" id="take_profit" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Last News Positivity (%)</span>
</div>
<input type="text" class="form-control" id="news_analysis" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Market Depth Status</span>
</div>
<input type="text" class="form-control" id="market_depth_status" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Price Rise Probability (%)</span>
</div>
<input type="text" class="form-control" id="price_rise_probability" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Price Drop Probability (%)</span>
</div>
<input type="text" class="form-control" id="price_drop_probability" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Support (stop profit LONG or stop loss SHORT)</span>
</div>
<input type="text" class="form-control" id="support" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Resistence (stop loss LONG or take profit SHORT)</span>
</div>
<input type="text" class="form-control" id="resistence" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Millionaire Buying Transactions Number</span>
</div>
<input type="text" class="form-control" id="whales_buying_num" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Millionaire Selling Transactions Number</span>
</div>
<input type="text" class="form-control" id="whales_selling_num" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Poor Buying Transactions Number</span>
</div>
<input type="text" class="form-control" id="poveraccis_buying_num" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Poor Selling Transactions Number</span>
</div>
<input type="text" class="form-control" id="poveraccis_selling_num" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Millionaire Buying Transactions Volume</span>
</div>
<input type="text" class="form-control" id="whales_buying_vol" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Millionaire Selling Transactions Volume</span>
</div>
<input type="text" class="form-control" id="whales_selling_vol" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Poor Buying Transactions Volume</span>
</div>
<input type="text" class="form-control" id="poveraccis_buying_vol" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Poor Selling Transactions Volume</span>
</div>
<input type="text" class="form-control" id="poveraccis_selling_vol" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Percentual Gain (x1)</span>
</div>
<input type="text" class="form-control" id="take_profit_percentual_x1" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Percentual Gain (x5)</span>
</div>
<input type="text" class="form-control" id="take_profit_percentual_x5" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Percentual Gain (x10)</span>
</div>
<input type="text" class="form-control" id="take_profit_percentual_x10" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Percentual Gain (x20)</span>
</div>
<input type="text" class="form-control" id="take_profit_percentual_x20" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Percentual Gain (x30)</span>
</div>
<input type="text" class="form-control" id="take_profit_percentual_x30" aria-describedby="basic-addon3" style="pointer-events: none;">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Log</span>
</div>
<textarea class="form-control" id="log" aria-describedby="basic-addon3"></textarea>
</div>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">NB: Some predictions could be wrong. Use this software under your full
responsability.
</span>
</div>
<div class="container">
<span class="text-muted">v. 1.03 Beta</span>
</div>
<div class="container mt-3">
<span class="text-muted">If you want to collaborate with this project, visit the source code in <a href="https://github.com/dade1987/StockPricePredictor" target="_blank">https://github.com/dade1987/StockPricePredictor</a> or write to
<a href="mailto:davidecavallini1987@gmail.com">davidecavallini1987@gmail.com</a>.</span>
</div>
</footer>
<script>
function beep() {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Q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KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");
snd.play();
}
function sell() {
//2 bip vicini
beep();
setTimeout(function() {
beep()
}, 100)
}
function buy() {
//1 bip
beep();
}
var socket = io();
const trainButton = document.getElementById('train-button');
const autoOneMinuteButton = document.getElementById('auto-one-minute-button');
const autoFiveMinutesButton = document.getElementById('auto-five-minutes-button');
const clearAutoInvestmentButton = document.getElementById('clear-auto-investment-button');
const predictButton = document.getElementById('predict-button');
let startingTime = null;
let startingTimeString = "";
let time_steps = "";
trainButton.onclick = () => {
startingTime = new Date();
startingTimeString = startingTime.toString();
trainButton.disabled = true;
trainButton.textContent = "WAIT PLEASE...";
let currency_pair_1 = $("#currency_pair_1").val();
let currency_pair_2 = $("#currency_pair_2").val();
let time_interval = $("#time_interval").val();
let market_name = $("#market_name").val();
time_steps = $("#time_steps").val();
let epochs_number = 50; // $("#epochs_number").val();
socket.emit('predict', JSON.stringify({
market_name: market_name,
time_interval: time_interval,
currency_pair_1: currency_pair_1,
currency_pair_2: currency_pair_2,
time_steps: time_steps,
epochs_number: epochs_number,
training_enabled: true
}));
};
autoOneMinuteButton.onclick = () => {
startingTime = new Date();
startingTimeString = startingTime.toString();
trainButton.disabled = true;
trainButton.textContent = "AUTO INVESTING...";
autoOneMinuteButton.style.display = 'none';
autoFiveMinutesButton.style.display = 'none';
clearAutoInvestmentButton.style.display = 'inline-block';
let currency_pair_1 = $("#currency_pair_1").val();
let currency_pair_2 = $("#currency_pair_2").val();
let time_interval = $("#time_interval").val();
let market_name = $("#market_name").val();
time_steps = $("#time_steps").val();
let epochs_number = 50; // $("#epochs_number").val();
socket.emit('predict', JSON.stringify({
auto_loop: 'autoOneMinute',
market_name: market_name,
time_interval: time_interval,
currency_pair_1: currency_pair_1,
currency_pair_2: currency_pair_2,
time_steps: time_steps,
epochs_number: epochs_number,
training_enabled: true
}));
};
autoFiveMinutesButton.onclick = () => {
startingTime = new Date();
startingTimeString = startingTime.toString();
trainButton.disabled = true;
trainButton.textContent = "AUTO INVESTING...";
autoOneMinuteButton.style.display = 'none';
autoFiveMinutesButton.style.display = 'none';
clearAutoInvestmentButton.style.display = 'inline-block';
let currency_pair_1 = $("#currency_pair_1").val();
let currency_pair_2 = $("#currency_pair_2").val();
let time_interval = $("#time_interval").val();
let market_name = $("#market_name").val();
time_steps = $("#time_steps").val();
let epochs_number = 50; // $("#epochs_number").val();
socket.emit('predict', JSON.stringify({
auto_loop: 'autoFiveMinute',
market_name: market_name,
time_interval: time_interval,
currency_pair_1: currency_pair_1,
currency_pair_2: currency_pair_2,
time_steps: time_steps,
epochs_number: epochs_number,
training_enabled: true
}));
};
clearAutoInvestmentButton.onclick = () => {
startingTime = new Date();
startingTimeString = startingTime.toString();
trainButton.disabled = false;
trainButton.textContent = "PREDICT";
autoOneMinuteButton.style.display = 'inline-block';
autoFiveMinutesButton.style.display = 'inline-block';
clearAutoInvestmentButton.style.display = 'none';
let currency_pair_1 = $("#currency_pair_1").val();
let currency_pair_2 = $("#currency_pair_2").val();
let time_interval = $("#time_interval").val();
let market_name = $("#market_name").val();
time_steps = $("#time_steps").val();
let epochs_number = 50; // $("#epochs_number").val();
socket.emit('predict', JSON.stringify({
auto_loop: 'clearAutoInvestment',
market_name: market_name,
time_interval: time_interval,
currency_pair_1: currency_pair_1,
currency_pair_2: currency_pair_2,
time_steps: time_steps,
epochs_number: epochs_number,
training_enabled: true
}));
};
/*predictButton.onclick = () => {
startingTime = new Date();
startingTimeString = startingTime.toString();
predictButton.disabled = true;
predictButton.textContent = "WAIT PLEASE...";
let currency_pair_1 = $("#currency_pair_1").val();
let currency_pair_2 = $("#currency_pair_2").val();
let time_interval = $("#time_interval").val();
let market_name = $("#market_name").val();
time_steps = $("#time_steps").val();
let epochs_number = '50'; //$("#epochs_number").val();
socket.emit('predict', JSON.stringify({
market_name: market_name,
time_interval: time_interval,
currency_pair_1: currency_pair_1,
currency_pair_2: currency_pair_2,
time_steps: time_steps,
epochs_number: epochs_number,
training_enabled: false
}));
};*/
/*socket.on('training', (result) => {
grafico(result, "Training");
});
socket.on('testing', (result) => {
grafico(result, "Testing");
});*/
socket.on('final', (result) => {
let endingTime = $("#time_interval option:selected").text();
let result2 = JSON.parse(result);
//console.log("result2", result2[13].resistence, result2[13].support);
//$("#finalResult").html("Prezzo Attuale: " + result2[7] + "\n\n" + result2[6] + " Take Profit Consigliato: " + parseFloat(result2[5]) + " \n\nPrevisioni delle " + startingTimeString + " tra " + endingTime + "\n\nCrescita: " + result2[0] + " Giusti: " + result2[1] + " Errori: " + result2[2] + " Pari: " + result2[3] + "\n\nMedia Aritmetica dei Quadrati degli Errori: " + result2[4][0] + " (dev'essere nell'ordine di 0.000X)");
/*$("#finalResult").html("Last Closed Price: " + result2[7] +
"\n\n" + result2[6] +
" Predicted Take Profit: " + parseFloat(result2[5]) +
"\n\nTake Profit Percentual Gain: " + parseFloat(result2[8]).toFixed(2) + "% (x1) "
+ (parseFloat(result2[8]) * 5).toFixed(2) + "% (x5) "
+ (parseFloat(result2[8]) * 10).toFixed(2) + "% (x10) "
+ (parseFloat(result2[8]) * 20).toFixed(2) + "% (x20) "
+ (parseFloat(result2[8]) * 30).toFixed(2) + "% (x30) ");*/
let date = new Date();
let readable_date = date.getDate() + '-' + date.getMonth() + '-' + date.getFullYear() + ' ' + date.getHours() + ':' + date.getMinutes() + ":" + date.getSeconds();
$("#last_price").val(result2[7]);
$("#log").val($("#log").val() + 'Time: ' + readable_date + ' Last Price: ' + result2[7] + '\n');
$("#advice").val(result2[6]);
$("#take_profit").val(parseFloat(result2[5]));
$("#news_analysis").val(parseFloat(result2[9]));
$("#market_depth_status").val(result2[12]);
$("#price_rise_probability").val(parseFloat(result2[10]).toFixed(2));
$("#price_drop_probability").val(parseFloat(result2[11]).toFixed(2));
if (result2[6] === "BUY") {
buy();
} else if (result2[6] === "SELL") {
sell();
}
$("#log").val($("#log").val() + 'Time: ' + readable_date + ' R: ' + parseFloat(result2[10]).toFixed(2) + ' D: ' + parseFloat(result2[11]).toFixed(2) + ' Sup: ' + result2[13].support + ' Res: ' + result2[13].resistence + '\n');
$("#take_profit_percentual_x1").val(parseFloat(result2[8]).toFixed(2));
$("#take_profit_percentual_x5").val((parseFloat(result2[8]) * 5).toFixed(2));
$("#take_profit_percentual_x10").val((parseFloat(result2[8]) * 10).toFixed(2));
$("#take_profit_percentual_x20").val((parseFloat(result2[8]) * 20).toFixed(2));
$("#take_profit_percentual_x30").val((parseFloat(result2[8]) * 30).toFixed(2));
$("#support").val(result2[13].support);
$("#resistence").val(result2[13].resistence);
$("#whales_buying_num").val(result2[14].whales_buying_num);
$("#whales_selling_num").val(result2[14].whales_selling_num);
$("#poveraccis_buying_num").val(result2[14].poveraccis_buying_num);
$("#poveraccis_selling_num").val(result2[14].poveraccis_selling_num);
$("#whales_buying_vol").val(result2[14].whales_buying_vol);
$("#whales_selling_vol").val(result2[14].whales_selling_vol);
$("#poveraccis_buying_vol").val(result2[14].poveraccis_buying_vol);
$("#poveraccis_selling_vol").val(result2[14].poveraccis_selling_vol);
trainButton.disabled = false;
trainButton.textContent = "PREDICT";
/*predictButton.disabled = true;
predictButton.textContent = "ONLY PREDICT (AFTER TRAINING)";*/
});
function grafico(bi_array_json, titolo) {
let result = JSON.parse(bi_array_json);
tfvis.render.linechart({
name: titolo
}, {
values: [result[0], result[1]],
series: ['original', 'predicted']
}, {
xLabel: 'contatore',
yLabel: 'prezzo',
height: 300,
zoomToFit: true
});
}
function fillCurrencyPairs(market_name) {
switch (market_name) {
case "FOREX":
$("#currency_pair_1").html("\
<option>EUR</option>\n\
<option>USD</option>\n\
<option>GBP</option>");
$("#currency_pair_2").html("\
<option>EUR</option>\n\
<option selected>USD</option>\n\
<option>GBP</option>");
break;
case "CRYPTO":
$("#currency_pair_1").html("\
<option>BTC</option>\n\
<option>DOGE</option>\n\
<option>DOT</option>\n\
<option>ADA</option>\n\
<option>XRP</option>\n\
<option>BNB</option>\n\
<option>SHIB</option>");
$("#currency_pair_2").html("<option>USD</option>");
break;
}
}
//la prima volta parte al minuto 1, poi fa ogni minuto
let timeout;
let interval;
function autoOneMinute() {
$('#time_interval option[value="INTRADAY_1_MIN"]').prop('selected', true);
let next_minute_date = new Date();
next_minute_date.setMinutes(next_minute_date.getMinutes() + 1)
next_minute_date.setSeconds(1);
let next_minute = next_minute_date.getTime();
let current_date = Date.now();
let wait_fist_time = next_minute_date - current_date;
timeout = setTimeout(function() {
trainButton.click();
interval = setInterval(function() {
trainButton.click();
}, 60000);
}, wait_fist_time);
console.log('wait_fist_time', wait_fist_time);
}
function clearAuto() {
clearTimeout(timeout);
clearInterval(interval);
}
</script>
</body>
</html>