-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
1517 lines (1315 loc) · 67.2 KB
/
app.py
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
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
################################################################
################################################################
import os
import re
import sys
import PIL
import json
import time
import uuid
import socket
import random
import hashlib
import sqlite3
import threading
from PIL import Image
from components import resources, icons
################################################################
import components
from datetime import datetime
from collections import Counter
########################################################################
import numpy as np
import pandas as pd
import pandas, requests
###################################################################
import asyncio
import telegram
from telethon import TelegramClient
from telegram.ext import Updater, MessageHandler, CommandHandler
###################################################################
from googleapiclient.discovery import build
from TelegramCrawler import TelegramCrawler
###################################################################
from PyQt5 import uic
from PyQt5.uic import loadUi
from PyQt5.QtGui import QIcon, QFont, QFontDatabase
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl, QTimer, QThread, pyqtSignal, QFile, QTextStream, QUrlQuery
from PyQt5.QtWidgets import QMainWindow, QDialog, QApplication, QToolTip, QWidget, QPushButton, QLineEdit, QTextEdit, QProgressBar, QMessageBox, QFontComboBox, QFileDialog, QLabel, QComboBox, QGraphicsView, QTableView, QHBoxLayout
################################################################
_DEFAULT_PAGE_SIZE = 1000
## --> GLOBALS
counter = 0
max_value = 10
def usd_jpy():
# Set the base URL for the API endpoint
base_url = "https://api.exchangerate-api.com/v4/latest/USD"
# Make a GET request to the API
response = requests.get(base_url)
# Check the status code of the response to make sure it was successful
if response.status_code == 200:
# Parse the response data as JSON
data = response.json()
# Get the exchange rate for USD/JPY from the response data
usd_jpy_rate = data['rates']['JPY']
# Return the currency pair and exchange rate as a tuple
return ("USD/JPY", usd_jpy_rate)
else:
# If the request was not successful, return None
return None
# Get the currency pair and exchange rate
currency_pair, exchange_rate = usd_jpy()
usd_pair = currency_pair
usd_rate = exchange_rate
def eur_usd():
# Set the base URL for the API endpoint
base_url = "https://api.exchangerate-api.com/v4/latest/USD"
# Make a GET request to the API
response = requests.get(base_url)
# Check the status code of the response to make sure it was successful
if response.status_code == 200:
# Parse the response data as JSON
data = response.json()
# Get the exchange rate for EUR/USD from the response data
eur_usd_rate = data['rates']['EUR']
# Return the currency pair and exchange rate as a tuple
return ("EUR/USD", eur_usd_rate)
else:
# If the request was not successful, return None
return None
# Get the currency pair and exchange rate
currency_pair, exchange_rate = eur_usd()
eur_pair = currency_pair
eur_rate = exchange_rate
def usd_cad():
# Set the base URL for the API endpoint
base_url = "https://api.exchangerate-api.com/v4/latest/USD"
# Make a GET request to the API
response = requests.get(base_url)
# Check the status code of the response to make sure it was successful
if response.status_code == 200:
# Parse the response data as JSON
data = response.json()
# Get the exchange rate for USD/JPY from the response data
usd_cad_rate = data['rates']['CAD']
# Return the currency pair and exchange rate as a tuple
return ("USD/CAD", usd_cad_rate)
else:
# If the request was not successful, return None
return None
# Get the currency pair and exchange rate
currency_pair, exchange_rate = usd_cad()
cad_pair = currency_pair
cad_rate = exchange_rate
def gbp_usd():
# Set the base URL for the API endpoint
base_url = "https://api.exchangerate-api.com/v4/latest/USD"
# Make a GET request to the API
response = requests.get(base_url)
# Check the status code of the response to make sure it was successful
if response.status_code == 200:
# Parse the response data as JSON
data = response.json()
# Get the exchange rate for USD/JPY from the response data
gbp_usd_rate = data['rates']['GBP']
# Return the currency pair and exchange rate as a tuple
return ("GBP/USD", gbp_usd_rate)
else:
# If the request was not successful, return None
return None
# Get the currency pair and exchange rate
currency_pair, exchange_rate = gbp_usd()
gbp_pair = currency_pair
gbp_rate = exchange_rate
def get_trading_pairs():
# Set the base URL for the API endpoint
base_url = "https://api.exchangerate-api.com/v4/latest/USD"
# Make a GET request to the API
response = requests.get(base_url)
# Check the status code of the response to make sure it was successful
if response.status_code == 200:
# Parse the response data as JSON
data = response.json()
# Get the list of available trading pairs
trading_pairs = ["USD/" + currency for currency in data['rates'].keys()] + ["EUR/" + currency for currency in data['rates'].keys()]
# Return the list of trading pairs
return trading_pairs
else:
# If the request was not successful, return None
return None
# Get the list of trading pairs
trading_pairs = get_trading_pairs()
class TelegramCrawlerThread(QThread):
signal = pyqtSignal(str, str, str, str)
def __init__(self, selected_pair):
QThread.__init__(self)
self.selected_pair = selected_pair
def run(self):
self.telegram_crawler = TelegramCrawler()
self.telegram_crawler.init(self.selected_pair)
signal, currency, entry, time = self.telegram_crawler.get_result()
self.signal.emit(signal, currency, entry, time)
class MyThread(QtCore.QThread):
update_signal = QtCore.pyqtSignal(str)
reset_signal = QtCore.pyqtSignal()
def __init__(self):
super().__init__()
self.counter = None
def run(self):
while self.counter > 0:
hours = self.counter // 3600
minutes = (self.counter % 3600) // 60
seconds = self.counter % 60
display_text = f"{hours:02d}:{minutes:02d}:{seconds:02d}"
self.update_signal.emit(display_text)
QtCore.QThread.sleep(1)
self.counter -= 1
# emit reset signal when counter reaches 0
self.reset_signal.emit()
class headerThread(QtCore.QThread):
update_header_function = QtCore.pyqtSignal(float, float, float, float)
def __init__(self):
super().__init__()
def run(self):
while True:
listNumber = random.uniform(0.75, 0.95)
updatePriceFunction = round(int(listNumber*100), 3)
updatePriceFunction_2 = round(int(listNumber*100), 3)
updatePriceFunction_3 = round(int(listNumber*100), 3)
updatePriceFunction_4 = round(int(listNumber*100), 3)
self.update_header_function.emit(updatePriceFunction, updatePriceFunction_2, updatePriceFunction_3, updatePriceFunction_4)
self.sleep(2)
class ApplicationScreen(QMainWindow):
def __init__(self):
super(ApplicationScreen, self).__init__()
loadUi("components/binary.ui", self)
self.telegram_crawler = TelegramCrawler()
self.check_saved_login()
# Start headerThread
self.headerThread = headerThread()
self.headerThread.update_header_function.connect(self.update_header)
self.headerThread.start()
########################################################################
comboTimes = ["1 mins", "2 mins", "3 mins", "4 mins", "5 mins", "10 mins", "15 mins", "30 mins"]
self.combo_2 = self.findChild(QComboBox, "comboTimer")
self.combo_2.addItems(comboTimes)
self.combo_2.setCurrentText("Trading Time")
self.combo_2.currentTextChanged.connect(self.combo_selection_changed)
self.my_thread = MyThread()
self.my_thread.update_signal.connect(self.update_progress_bar)
self.my_thread.reset_signal.connect(self.reset)
self.passwordfield.setEchoMode(QLineEdit.Password)
self.adminPassword.setEchoMode(QLineEdit.Password)
self.passwordfield_2.setEchoMode(QLineEdit.Password)
self.confirmpassword.setEchoMode(QLineEdit.Password)
self.askTag.setText(usd_pair)
self.quoteTag.setText(str(usd_rate))
self.askTag_2.setText(gbp_pair)
self.quoteTag_2.setText(str(gbp_rate))
self.askTag_3.setText(eur_pair)
self.quoteTag_3.setText(str(eur_rate))
self.askTag_4.setText(cad_pair)
self.quoteTag_4.setText(str(cad_rate))
self.askTag.hide()
self.quoteTag.hide()
self.askTag_2.hide()
self.quoteTag_2.hide()
self.askTag_3.hide()
self.quoteTag_3.hide()
self.askTag_4.hide()
self.quoteTag_4.hide()
QtCore.QTimer.singleShot(1000, lambda: self.askTag.show())
QtCore.QTimer.singleShot(3000, lambda: self.quoteTag.show())
QtCore.QTimer.singleShot(5000, lambda: self.askTag_2.show())
QtCore.QTimer.singleShot(7000, lambda: self.quoteTag_2.show())
QtCore.QTimer.singleShot(9000, lambda: self.askTag_3.show())
QtCore.QTimer.singleShot(11000, lambda: self.quoteTag_3.show())
QtCore.QTimer.singleShot(13000, lambda: self.askTag_4.show())
QtCore.QTimer.singleShot(15000, lambda: self.quoteTag_4.show())
QtCore.QTimer.singleShot(20000, lambda: self.askTag.setText("EUR/USD"))
QtCore.QTimer.singleShot(24000, lambda: self.quoteTag.setText("AUD/USD"))
QtCore.QTimer.singleShot(28000, lambda: self.askTag_2.setText("USD/JPY"))
QtCore.QTimer.singleShot(32000, lambda: self.quoteTag_2.setText("GBP/USD"))
QtCore.QTimer.singleShot(36000, lambda: self.askTag_3.setText("USD/CHF"))
QtCore.QTimer.singleShot(40000, lambda: self.quoteTag_3.setText("USD/CAD"))
QtCore.QTimer.singleShot(44000, lambda: self.askTag_4.setText("NZD/USD"))
QtCore.QTimer.singleShot(48000, lambda: self.quoteTag_4.setText("AUD/CAD"))
QtCore.QTimer.singleShot(52000, lambda: self.askTag.setText("AUD/CHF"))
QtCore.QTimer.singleShot(56000, lambda: self.quoteTag.setText("AUD/JPY"))
QtCore.QTimer.singleShot(60000, lambda: self.askTag_2.setText("AUD/NZD"))
QtCore.QTimer.singleShot(64000, lambda: self.quoteTag_2.setText("CAD/CHF"))
QtCore.QTimer.singleShot(68000, lambda: self.askTag_3.setText("CAD/JPY"))
QtCore.QTimer.singleShot(72000, lambda: self.quoteTag_3.setText("CHF/JPY"))
QtCore.QTimer.singleShot(76000, lambda: self.askTag_4.setText("EUR/AUD"))
QtCore.QTimer.singleShot(80000, lambda: self.quoteTag_4.setText("EUR/CAD"))
QtCore.QTimer.singleShot(84000, lambda: self.quoteTag_2.setText("EUR/CHF"))
QtCore.QTimer.singleShot(88000, lambda: self.askTag_3.setText("EUR/GBP"))
QtCore.QTimer.singleShot(92000, lambda: self.quoteTag_3.setText("EUR/JPY"))
QtCore.QTimer.singleShot(96000, lambda: self.askTag_4.setText("EUR/NZD"))
QtCore.QTimer.singleShot(100000, lambda: self.quoteTag_4.setText("GBP/AUD"))
QtCore.QTimer.singleShot(104000, lambda: self.quoteTag_2.setText("GBP/CAD"))
QtCore.QTimer.singleShot(108000, lambda: self.askTag_3.setText("GBP/CHF"))
QtCore.QTimer.singleShot(112000, lambda: self.quoteTag_3.setText("GBP/JPY"))
QtCore.QTimer.singleShot(116000, lambda: self.askTag_4.setText("GBP/NZD"))
QtCore.QTimer.singleShot(120000, lambda: self.quoteTag_4.setText("NZD/CAD"))
QtCore.QTimer.singleShot(124000, lambda: self.quoteTag_2.setText("NZD/CHF"))
QtCore.QTimer.singleShot(128000, lambda: self.askTag_3.setText("NZD/JPY"))
QtCore.QTimer.singleShot(132000, lambda: self.quoteTag_3.setText("XAU/USD"))
QtCore.QTimer.singleShot(136000, lambda: self.askTag.setText("EUR/USD"))
QtCore.QTimer.singleShot(140000, lambda: self.quoteTag.setText("AUD/USD"))
QtCore.QTimer.singleShot(144000, lambda: self.askTag_2.setText("USD/JPY"))
QtCore.QTimer.singleShot(148000, lambda: self.quoteTag_2.setText("GBP/USD"))
QtCore.QTimer.singleShot(152000, lambda: self.askTag_3.setText("USD/CHF"))
QtCore.QTimer.singleShot(156000, lambda: self.quoteTag_3.setText("USD/CAD"))
QtCore.QTimer.singleShot(160000, lambda: self.askTag_4.setText("NZD/USD"))
QtCore.QTimer.singleShot(164000, lambda: self.quoteTag_4.setText("AUD/CAD"))
QtCore.QTimer.singleShot(168000, lambda: self.askTag.setText("AUD/CHF"))
QtCore.QTimer.singleShot(172000, lambda: self.quoteTag.setText("AUD/JPY"))
QtCore.QTimer.singleShot(176000, lambda: self.askTag_2.setText("AUD/NZD"))
QtCore.QTimer.singleShot(180000, lambda: self.quoteTag_2.setText("CAD/CHF"))
QtCore.QTimer.singleShot(184000, lambda: self.askTag_3.setText("CAD/JPY"))
QtCore.QTimer.singleShot(188000, lambda: self.quoteTag_3.setText("CHF/JPY"))
QtCore.QTimer.singleShot(192000, lambda: self.askTag_4.setText("EUR/AUD"))
QtCore.QTimer.singleShot(196000, lambda: self.quoteTag_4.setText("EUR/CAD"))
QtCore.QTimer.singleShot(200000, lambda: self.quoteTag_2.setText("EUR/CHF"))
QtCore.QTimer.singleShot(204000, lambda: self.askTag_3.setText("EUR/GBP"))
QtCore.QTimer.singleShot(208000, lambda: self.quoteTag_3.setText("EUR/JPY"))
QtCore.QTimer.singleShot(212000, lambda: self.askTag_4.setText("EUR/NZD"))
QtCore.QTimer.singleShot(216000, lambda: self.quoteTag_4.setText("GBP/AUD"))
QtCore.QTimer.singleShot(220000, lambda: self.quoteTag_2.setText("GBP/CAD"))
QtCore.QTimer.singleShot(224000, lambda: self.askTag_3.setText("GBP/CHF"))
QtCore.QTimer.singleShot(230000, lambda: self.quoteTag_3.setText("GBP/JPY"))
QtCore.QTimer.singleShot(234000, lambda: self.askTag_4.setText("GBP/NZD"))
QtCore.QTimer.singleShot(238000, lambda: self.quoteTag_4.setText("NZD/CAD"))
QtCore.QTimer.singleShot(242000, lambda: self.quoteTag_2.setText("NZD/CHF"))
QtCore.QTimer.singleShot(246000, lambda: self.askTag_3.setText("NZD/JPY"))
QtCore.QTimer.singleShot(250000, lambda: self.quoteTag_3.setText("XAU/USD"))
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.progress)
self.timer.start(60)
self.description.setText("FXsignalspot")
QtCore.QTimer.singleShot(2000, lambda: self.description.setText("<strong>Welcome</strong> to FXsignalspot Binary Trading"))
QtCore.QTimer.singleShot(3000, lambda: self.description.setText("<strong>Loading...</strong> Don't forget to check us out at https://www.fxsignalspot.com"))
QtCore.QTimer.singleShot(4000, lambda: self.description.setText("Check us out at https://www.fxsignalspot.com"))
QtCore.QTimer.singleShot(5000, lambda: self.description.setText("Welcome to Binary Trading with FXsignalspot"))
self.load.setText(" ")
QtCore.QTimer.singleShot(1100, lambda: self.load.setText("Loading"))
QtCore.QTimer.singleShot(1600, lambda: self.load.setText("Loading."))
QtCore.QTimer.singleShot(2100, lambda: self.load.setText("Loading.."))
QtCore.QTimer.singleShot(2600, lambda: self.load.setText("Loading..."))
QtCore.QTimer.singleShot(3100, lambda: self.load.setText("Loading"))
QtCore.QTimer.singleShot(3600, lambda: self.load.setText("Loading."))
QtCore.QTimer.singleShot(4100, lambda: self.load.setText("Loading.."))
QtCore.QTimer.singleShot(4600, lambda: self.load.setText("Loading..."))
QtCore.QTimer.singleShot(5100, lambda: self.load.setText("Loading"))
QtCore.QTimer.singleShot(5600, lambda: self.load.setText(" "))
self.show()
########################################################################
# Set QLabel Widgets
########################################################################
self.updateLabel.setText("EUR/USD")
self.updateLabel_6.setText("AUD/NZD")
self.updateLabel_2.setText("USD/JPY")
self.updateLabel_7.setText("CAD/JPY")
self.updateLabel_3.setText("NZD/CHF")
self.updateLabel_8.setText("NZD/CHF")
self.updateLabel_4.setText("GBP/CAD")
self.updateLabel_9.setText("CHF/JPY")
########################################################################
########################################################################
# Get the stacked widget page named telegramTrends
stacked_widget = self.telegramTrends
# Create a WebEngineView widget
web_view = QWebEngineView()
# Set the HTML of the WebEngineView widget to an iframe that embeds the website
web_view.setHtml(f'<iframe width="100%" height="100%" src="https://fxsignalspot.com/" frameborder="0"></iframe>')
# Add the WebEngineView widget to the layout of the page widget
stacked_widget.layout().addWidget(web_view)
########################################################################
# Get the stacked widget page named telegramPage
stacked_widget = self.telegramPage
# Create a WebEngineView widget and set the URL to the Telegram channel
web_view = QWebEngineView()
web_view.setUrl(QUrl("https://t.me/fxsignalspot"))
# Add the WebEngineView widget to the layout of the page widget
stacked_widget.layout().addWidget(web_view)
########################################################################
########################################################################
stacked_widget = self.subscriptionPage
web_view = QWebEngineView()
web_view.setHtml('''
<html>
<head>
</head>
<body>
<div class="PyQt_webview">
<div class="PyQt_header">
<h1>Welcome to our Subscription Page! Choose a plan that suits your needs.</h1>
<p>Thank you for considering our Subscription Plans. We offer three unique plans, each designed to cater to your specific needs and requirements.</p>
</div>
<div class="PyQt_webview_container flex_box">
<div class="PyQt_webview_box column">
<div class="PyQt_webview_header">
<h2>Basic Subscription</h2>
</div>
<div class="PyQt_webview_content">
<p>Access to all basic features</p>
<p>Limited support</p>
<p>Monthly cost: Free</p>
</div>
<div class="PyQt_webview_Btn">
<a href="#">Subscribe Here</a>
</div>
</div>
<div class="PyQt_webview_box column">
<div class="PyQt_webview_header">
<h2>Premium Subscription</h2>
</div>
<div class="PyQt_webview_content">
<p>Access to all basic and premium features</p>
<p>Priority support</p>
<p>Monthly cost: $44.00</p>
</div>
<div class="PyQt_webview_Btn">
<a href="#">Subscribe Here</a>
</div>
</div>
<div class="PyQt_webview_box column">
<div class="PyQt_webview_header">
<h2>Ultimate Subscription</h2>
</div>
<div class="PyQt_webview_content">
<p>Access to all basic, premium, and ultimate features</p>
<p>24/7 support</p>
<p>Monthly cost: $107.00</p>
</div>
<div class="PyQt_webview_Btn">
<a href="#">Subscribe Here</a>
</div>
</div>
</div>
<div class="PyQt_footer">
<p>Should you require any assistance in selecting a plan that suits your needs, please do not hesitate to reach out to us. Our customer support team is always available to assist you.</p>
</div>
</div>
<style>
.PyQt_webview{
justify-content: center;
align-content: center;
margin: auto;
padding: 2%;
}
.PyQt_webview_container{
justify-content: center;
align-content: center;
margin: auto;
}
.flex_box{
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, auto));
justify-content: center;
align-items: center;
margin: auto;
gap: 1.8rem;
padding: 2% 4%;
}
.PyQt_webview_box{
justify-content: center;
align-items: flex-start;
text-align: center;
display: flex;
flex-direction: row;
width: 100%;
height: auto;
padding: 10px;
margin: auto;
box-shadow: 0 5px 25px rgb(1 1 1 / 20%);
background-color: 0 5px 25px rgb(5 5 5 / 60%);
}
.PyQt_header{
justify-content: center;
align-content: center;
margin: auto;
text-align: center;
width: 80%;
}
.PyQt_header h1{
font-size: 1.4em;
font-weight: 700;
color: #000000;
}
.PyQt_header p{
font-size: 0.85em;
font-weight: 400;
color: #444444;
}
.PyQt_webview_header{
justify-content: center;
align-content: center;
margin: auto;
text-align: center;
}
.PyQt_webview_header h2{
font-size: 1em;
font-weight: 700;
color: #000000;
}
.PyQt_webview_header p{
font-size: 0.75em;
font-weight: 400;
color: #444444;
}
.PyQt_webview_content{
justify-content: center;
align-content: center;
margin: auto;
text-align: center;
}
.PyQt_webview_content p{
font-size: 0.75em;
font-weight: 400;
color: #444444;
}
.column{
justify-content: center;
align-content: center;
text-align: center;
margin: auto;
display: flex;
flex-direction: column;
text-align: center;
}
.PyQt_webview_Btn{
justify-content: center;
align-content: center;
margin: auto;
text-align: center;
}
.PyQt_webview_Btn a{
text-decoration: none;
font-size: 0.75em;
font-weight: 400;
color: #444444;
padding: 5px 10px;
border-radius: 4px;
background: #888888;
}
.PyQt_webview_Btn a:hover{
color: #888888;
background: #444444;
}
.PyQt_footer{
justify-content: center;
align-content: center;
margin: auto;
text-align: center;
width: 80%;
}
.PyQt_footer p{
text-align: center;
font-size: 0.85em;
font-weight: 400;
color: #444444;
}
</style>
</body>
</html>
''')
stacked_widget.layout().addWidget(web_view)
########################################################################
self.telegramBtn_2.clicked.connect(self.showTelegramChannel)
self.closeChannelBtn_2.clicked.connect(self.closeChannel)
self.brokerBtn_2.clicked.connect(self.trendingsFunc)
self.signalBtn_2.clicked.connect(self.trendings)
self.update_prices.clicked.connect(self.trendings)
self.telegramBtn.clicked.connect(self.showTelegramChannel)
self.notificationBtn.clicked.connect(self.showNotification)
self.hideNotificationBtn.clicked.connect(self.hideNotification)
self.closeChannelBtn.clicked.connect(self.closeChannel)
self.expandBtn.clicked.connect(self.expand)
self.restoreBtn.clicked.connect(self.restore)
self.openAccBtn.clicked.connect(self.openAcc)
self.closeAccBtn.clicked.connect(self.closeAcc)
self.showBtn.clicked.connect(self.showMenu)
self.hideBtn.clicked.connect(self.hideMenu)
self.proceedBtn.clicked.connect(lambda: self.stackedWidget.setCurrentWidget(self.homePage))
self.trendBtn.clicked.connect(self.subscriptionPageFunction)
self.trendBtn_2.clicked.connect(self.subscriptionPageFunction)
self.infoBtn.clicked.connect(self.gotoinfopage)
self.infoBtn_2.clicked.connect(self.gotoinfopage)
self.helpBtn.clicked.connect(self.gotohelppage)
self.helpBtn_2.clicked.connect(self.gotohelppage)
self.loginBtnSubmit.clicked.connect(self.loginfunction)
self.signUpBtnSubmit.clicked.connect(self.signupfunction)
self.goToLogInPage.clicked.connect(self.login_Form)
self.logInBtn.clicked.connect(self.login_Form)
self.forgetBtn.clicked.connect(self.sign_Up_Form)
self.signUpBtn.clicked.connect(self.sign_Up_Form)
self.lightMode.clicked.connect(self.light)
self.darkMode.clicked.connect(self.black)
self.brokerBtn.clicked.connect(self.trendingsFunc)
self.homeBtn.clicked.connect(self.homeContent)
self.signalBtn.clicked.connect(self.trendings)
self.showAdsBtn.clicked.connect(self.showAds)
self.hideAdsBtn.clicked.connect(self.hideAds)
self.logout.clicked.connect(self.logoutFunction)
self.settingBtn_2.clicked.connect(self.adminFunction)
self.settingBtn.clicked.connect(self.adminFunction)
self.adminLogin.clicked.connect(self.adminLoginFunction)
self.saveYoutube.clicked.connect(self.saveYoutubeFunction)
def adminFunction(self):
self.adminYoutube.hide()
self.saveYoutube.hide()
self.youtubeName.hide()
self.User_form.show()
self.signUpForm.hide()
self.loginForm.hide()
self.trendpage.hide()
self.bodyContent.hide()
def set_font_on_widgets(self):
# Step 1: Download the font file and store it in the project directory
font_file = QFile("components/fonts/Poppins-medium.ttf")
font_file.open(QFile.ReadOnly)
# Step 2: Create a QFont object and set its properties
font_id = QFontDatabase.addApplicationFontFromData(font_file.readAll())
font_name = QFontDatabase.applicationFontFamilies(font_id)[0]
font = QFont(font_name)
########################################################################
for widget in app.allWidgets():
widget.setFont(font)
#########################################################################
# This section contains the Binary Header for the software trading view #
#########################################################################
########################################################################
########################################################################
def update_header(self, updatePriceFunction, updatePriceFunction_2, updatePriceFunction_3, updatePriceFunction_4):
self.updatePrice.display(updatePriceFunction)
self.updatePrice_2.display(updatePriceFunction_2)
self.updatePrice_3.display(updatePriceFunction_3)
self.updatePrice_4.display(updatePriceFunction_4)
if updatePriceFunction > 78:
self.updateLabel.hide()
self.updateLabel_6.show()
elif updatePriceFunction <= 75:
self.updateLabel.show()
self.updateLabel_6.hide()
if updatePriceFunction_2 > 85:
self.updateLabel_2.hide()
self.updateLabel_7.show()
elif updatePriceFunction_2 <= 80:
self.updateLabel_2.show()
self.updateLabel_7.hide()
if updatePriceFunction_3 > 85:
self.updateLabel_3.hide()
self.updateLabel_8.show()
elif updatePriceFunction_3 <= 75:
self.updateLabel_3.show()
self.updateLabel_8.hide()
if updatePriceFunction_4 > 76:
self.updateLabel_4.hide()
self.updateLabel_9.show()
elif updatePriceFunction_4 <= 82:
self.updateLabel_4.show()
self.updateLabel_9.hide()
def gotoinfopage(self):
self.User_form.hide()
self.trendpage.hide()
self.bodyContent.show()
self.stackedWidget.setCurrentWidget(self.infoPage)
def gotohelppage(self):
self.User_form.hide()
self.trendpage.hide()
self.bodyContent.show()
self.stackedWidget.setCurrentWidget(self.helpPage)
def on_pair_selected(self, selected_pair):
self.telegram_thread = TelegramCrawlerThread(selected_pair)
self.telegram_thread.signal.connect(self.update_data)
self.telegram_thread.start()
def homeContent(self):
self.trendpage.hide()
self.loginForm.hide()
self.signUpForm.hide()
self.bodyContent.show()
self.stackedWidget.setCurrentWidget(self.homePage)
def subscriptionPageFunction(self):
self.openAccBtn.hide()
self.closeAccBtn.hide()
self.trendpage.hide()
self.loginForm.hide()
self.signUpForm.hide()
self.bodyContent.show()
self.stackedWidget.setCurrentWidget(self.subscriptionPage)
def trendingsFunc(self):
self.openAccBtn.hide()
self.closeAccBtn.hide()
self.trendpage.hide()
self.loginForm.hide()
self.signUpForm.hide()
self.bodyContent.show()
self.stackedWidget.setCurrentWidget(self.telegramTrends)
def delayresult(self):
self.signalBanner.hide()
self.getPairButton.hide()
self.comboPair.hide()
self.comboTimer.hide()
self.connectingLabel.show()
self.connectingLabel.setText("Getting signal")
QtCore.QTimer.singleShot(4000, lambda: self.connectingLabel.setText("Getting signal please wait..."))
QtCore.QTimer.singleShot(5000, lambda: self.connectingLabel.setText("Getting signal please wait"))
QtCore.QTimer.singleShot(6000, lambda: self.connectingLabel.setText("Getting signal please wait."))
QtCore.QTimer.singleShot(7000, lambda: self.connectingLabel.setText("Getting signal please wait.."))
QtCore.QTimer.singleShot(8000, lambda: self.connectingLabel.setText("Getting signal please wait..."))
QtCore.QTimer.singleShot(9500, lambda: self.connectingLabel.setText("Please place your trade and monitor the timer, do not let forget to check fxsignalspot."))
QtCore.QTimer.singleShot(13500, lambda: self.connectingLabel.setText("Visit fxsignalspot at https://www.fxsignalspot.com."))
QtCore.QTimer.singleShot(17500, lambda: self.connectingLabel.setText("Subscribe to our service to get the best Binary Forecast, <br> Check our Subscription page for more details."))
QtCore.QTimer.singleShot(21500, lambda: self.connectingLabel.setText("Please hold on, you can't place another trade until this session as been exhausted."))
QtCore.QTimer.singleShot(25500, lambda: self.connectingLabel.setText("From fxsignalspot we wish you a successful trading experience."))
QtCore.QTimer.singleShot(29500, lambda: self.connectingLabel.setText("Please place your trade and monitor the timer, do not let forget to check fxsignalspot."))
QtCore.QTimer.singleShot(33500, lambda: self.connectingLabel.setText("Visit fxsignalspot at https://www.fxsignalspot.com."))
QtCore.QTimer.singleShot(37500, lambda: self.connectingLabel.setText("Subscribe to our service to get the best Binary Forecast, <br> Check our Subscription page for more details."))
QtCore.QTimer.singleShot(41500, lambda: self.connectingLabel.setText("Please hold on, you can't place another trade until this session as been exhausted."))
QtCore.QTimer.singleShot(45500, lambda: self.connectingLabel.setText("From fxsignalspot we wish you a successful trading experience."))
QtCore.QTimer.singleShot(49500, lambda: self.connectingLabel.setText("Please place your trade and monitor the timer, do not let forget to check fxsignalspot."))
QtCore.QTimer.singleShot(53500, lambda: self.connectingLabel.setText("Visit fxsignalspot at https://www.fxsignalspot.com."))
QtCore.QTimer.singleShot(57500, lambda: self.connectingLabel.setText("Subscribe to our service to get the best Binary Forecast, <br> Check our Subscription page for more details."))
QtCore.QTimer.singleShot(61500, lambda: self.connectingLabel.setText("Please hold on, you can't place another trade until this session as been exhausted."))
QtCore.QTimer.singleShot(65500, lambda: self.connectingLabel.setText("From fxsignalspot we wish you a successful trading experience."))
QtCore.QTimer.singleShot(69500, lambda: self.connectingLabel.setText("Subscribe to our service to get the best Binary Forecast, <br> Check our Subscription page for more details."))
QtCore.QTimer.singleShot(73500, lambda: self.connectingLabel.setText("Please hold on, you can't place another trade until this session as been exhausted."))
QtCore.QTimer.singleShot(77500, lambda: self.connectingLabel.setText("From fxsignalspot we wish you a successful trading experience."))
QtCore.QTimer.singleShot(81500, lambda: self.connectingLabel.setText("Subscribe to our service to get the best Binary Forecast, <br> Check our Subscription page for more details."))
QtCore.QTimer.singleShot(85500, lambda: self.connectingLabel.setText("Please hold on, you can't place another trade until this session as been exhausted."))
QtCore.QTimer.singleShot(89500, lambda: self.connectingLabel.setText("From fxsignalspot we wish you a successful trading experience."))
#Trade Pair to Setup
def trendings(self):
# code for displaying signal screen
self.User_form.hide()
self.trendpage.show()
self.loginForm.hide()
self.signUpForm.hide()
self.bodyContent.hide()
self.telegramNotification.hide()
fixedPair = ['EUR/USD', 'AUD/USD', 'USD/JPY', 'GBP/USD', 'USD/CHF', 'USD/CAD', 'NZD/USD', 'AUD/CAD', 'AUD/CHF', 'AUD/JPY', 'AUD/NZD', 'CAD/CHF', 'CAD/JPY', 'CHF/JPY', 'EUR/AUD', 'EUR/CAD', 'EUR/CHF', 'EUR/GBP', 'EUR/JPY', 'EUR/NZD', 'GBP/AUD', 'GBP/CAD', 'GBP/CHF', 'GBP/JPY', 'GBP/NZD', 'NZD/CAD', 'NZD/CHF', 'NZD/JPY', 'XAU/USD']
self.combo_1 = self.findChild(QComboBox, "comboPair")
self.trade_pair = fixedPair
self.trade_pair_list = list(self.trade_pair)
self.combo_1.addItems(self.trade_pair_list)
self.combo_1.setCurrentText("EUR/USD")
# Add a button to get the selected trading pair and rate
self.get_pair_button = self.findChild(QPushButton, "getPairButton")
self.get_pair_button.clicked.connect(self.runSignal)
def init_web_view(self):
conn = sqlite3.connect("components/fxglobal.db")
cur = conn.cursor()
cur.execute("SELECT youtube FROM Links ORDER BY id DESC LIMIT 1")
result = cur.fetchone()
if result:
video_url = result[0]
trendpage = self.advert
if hasattr(self, 'web_view'):
self.web_view.deleteLater()
self.web_view = None
self.web_view = QWebEngineView()
self.web_view.setUrl(QUrl(video_url + str("?autoplay=1")))
self.web_view.loadFinished.connect(self.enter_fullscreen)
trendpage.layout().addWidget(self.web_view)
def enter_fullscreen(self):
self.web_view.page().runJavaScript("document.querySelector('iframe').requestFullscreen();")
def showAds(self):
self.init_web_view()
self.binaryUpdateHeader.hide()
self.advert.show()
self.loginForm.hide()
self.signUpForm.hide()
self.bodyContent.hide()
self.telegramNotification.hide()
self.timerBar_3.show()
self.headerMenuContainer.hide()
self.menuContainer.hide()
self.showAdsBtn.hide()
self.signalContainer.hide()
self.telegramCurrency.show()
def hideAds(self):
self.init_web_view()
self.binaryUpdateHeader.show()
self.telegramCurrency.hide()
self.timerBar_3.hide()
self.advert.hide()
self.binaryScreen.show()
self.hideAdsBtn.hide()
self.showAdsBtn.hide()
self.signalContainer.show()
self.menuContainer.hide()
self.headerMenuContainer.show()
def get_trading_pairs_from_combo_box(self):
try:
self.selected_pair = self.combo_1.currentText()
selected_pair = self.combo_1.currentText()
if selected_pair not in self.trade_pair:
QMessageBox.about(self, "Notice", "<strong><small><center>You either did not select any Trading Pair or your Trading Pair is not found in the list.</center></small></strong>")
else:
base_currency = selected_pair.split("/")[0]
quote_currency = selected_pair.split("/")[1]
base_url = f"https://api.exchangerate-api.com/v4/latest/{base_currency}"
# Make a GET request to the API
response = requests.get(base_url)
# Check the status code of the response to make sure it was successful
if response.status_code == 200:
# Parse the response data as JSON
data = response.json()
# Get the exchange rate for the selected pair from the response data
rate = data['rates'][quote_currency]
# Return the currency pair and exchange rate as a tuple
return (selected_pair, rate)
else:
# If the request was not successful, return None
return None
except Exception as e:
QMessageBox.about(self, "Notice", "<strong><small><center>An Error Occurred</center></small></strong><br> <p><small></small></p><br/>" + str(e))
def display_message(self):
self.signalLabel.show()
self.telegramAction.hide()
self.telegramAction_2.hide()
QtCore.QTimer.singleShot(1000, lambda: self.signalLabel.setText(str("Wait.")))
QtCore.QTimer.singleShot(2000, lambda: self.signalLabel.setText(str("Wait..")))
QtCore.QTimer.singleShot(3000, lambda: self.signalLabel.setText(str("Wait...")))
QtCore.QTimer.singleShot(4000, lambda: self.signalLabel.setText(str("Wait.")))
QtCore.QTimer.singleShot(5000, lambda: self.signalLabel.setText(str("Wait..")))
QtCore.QTimer.singleShot(6000, lambda: self.signalLabel.setText(str("Wait...")))
QtCore.QTimer.singleShot(7000, lambda: self.signalLabel.setText(str("Wait.")))
QtCore.QTimer.singleShot(8000, lambda: self.signalLabel.setText(str("Wait..")))
QtCore.QTimer.singleShot(9000, lambda: self.signalLabel.hide())
def get_selected_pair(self):
try:
# Get the selected trading pair and rate
selected_pair, rate = self.get_trading_pairs_from_combo_box()
if selected_pair is None:
QMessageBox.about(self, "Notice", "<strong><small><center>You either did not select any Trading Pair or your Trading Pair is not found in the list.</center></small></strong>")
else:
#set to a label
self.labelPair.setText(selected_pair)
self.labelPair_1.setText(str(rate))
# Calculate the signal strength (you can use any method you want to calculate the signal strength)
signal_strength = rate * 80
# Update the progress bar to show the signal strength
self.progress_bar = self.findChild(QProgressBar, "strengthBar")
self.progress_bar.setValue(round(int(signal_strength)))
getstrengthBar = self.progress_bar.setValue(int(signal_strength))
signal_strength = random.uniform(0.85, 0.95)
getPercentage = round(int(signal_strength*100), 3)
self.strengthBar_5.setText(str(getPercentage) + " %")
except Exception as e:
QMessageBox.about(self, "Notice", "<center><strong><small><center>An Error Occurred</center></small></strong><br> <p><small>Check your Network Connection!!!</small></p></center><br/>" + str(e))
def start_timer_thread(self,counter_value):
self.my_thread.counter = counter_value
self.my_thread.start()
def combo_selection_changed(self):
combo_value = self.combo_2.currentText()
if combo_value == "1 mins":
counter_value = 60
elif combo_value == "2 mins":
counter_value = 120
elif combo_value == "3 mins":
counter_value = 180
elif combo_value == "4 mins":
counter_value = 240
elif combo_value == "5 mins":
counter_value = 300
elif combo_value == "10 mins":
counter_value = 600
elif combo_value == "15 mins":
counter_value = 900
elif combo_value == "30 mins":
counter_value = 1800
elif combo_value == "1 hrs":
counter_value = 3600
elif combo_value == "2 hrs":
counter_value = 7200
elif combo_value == "3 hrs":
counter_value = 10800
elif combo_value == "4 hrs":
counter_value = 14400
elif combo_value == "5 hrs":
counter_value = 18000
self.start_timer_thread(counter_value)
def adminLoginFunction(self):
user = self.adminUser.text()
password = self.adminPassword.text()
if len(user) == 0 or len(password) == 0:
self.adminMessage.setText("Please fill all Fields !!! ")
return
try:
adminName = "fxsignalspot"
adminPass = "@Avalanche_1998_1991_06"
if user == adminName and password == adminPass:
QtCore.QTimer.singleShot(1000, lambda: self.youtubeName.show())
QtCore.QTimer.singleShot(1000, lambda: self.saveYoutube.show())
QtCore.QTimer.singleShot(1000, lambda: self.adminYoutube.show())
QtCore.QTimer.singleShot(1000, lambda: self.adminUser.hide())
QtCore.QTimer.singleShot(1000, lambda: self.adminPassword.hide())
QtCore.QTimer.singleShot(1000, lambda: self.adminLogin.hide())
self.adminMessage.setText("Login Successful !!! ")