-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.py
3377 lines (3010 loc) · 208 KB
/
core.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
#!/usr/bin/env python3
# Built-in and Third-Party Libs
import ctypes
import fileinput
import json
import logging
import math
import os
import platform
import random
import re
import shutil
import smtplib
import socket
import string as string_str
import subprocess
import sys
import time
import traceback
import uuid
from datetime import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from os.path import exists
from string import Template
from sys import platform
import click
import numpy
import psutil
import talib
import unicorn_binance_websocket_api
import websocket
from binance.client import Client
from binance.enums import *
logging.getLogger("unicorn_binance_websocket_api").disabled = True
def current_dir_path_export():
current_dir_path = os.path.dirname(os.path.abspath(__file__))
os.environ["CURRENT_DIR_PATH"] = current_dir_path
current_dir_path_export()
# Custom Libs
from custom_modules.cfg import bootstrap, variables_reinitialization
from custom_modules.logging.logging import bcolors, log
from custom_modules.telegram.telegram_passive import telegram
###############################################
######## UNIQUE ID FUNCTION #########
###############################################
def id_generator(size=10, chars=string_str.ascii_uppercase + string_str.digits):
return "".join(random.choice(chars) for elem in range(size))
###############################################
######### ACCOUNT FUNCTIONS #########
###############################################
def user_initial_config():
global client
try:
client = Client(bootstrap.RYBKA_BIN_KEY, bootstrap.RYBKA_BIN_SECRET)
log.INFO_BOLD(f" ✅ Client initial config - {bcolors.PURPLE}DONE")
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"Client initial config - FAILED\nError encountered at setting user config. via API KEY and API SECRET. Please check error below:\n{e}"
)
def account_balance_update():
global client
global balance_stablecoin
global balance_cryptocoin
global balance_bnb
global locked_balance_stablecoin
global locked_balance_cryptocoin
global locked_balance_bnb
balance_aux_stablecoin = client.get_asset_balance(asset=bootstrap.STABLECOIN_SYMBOL)
if float(balance_aux_stablecoin["free"]) == round(float(balance_aux_stablecoin["free"]), 4):
balance_stablecoin = round(float(balance_aux_stablecoin["free"]), 4)
else:
balance_stablecoin = round(float(balance_aux_stablecoin["free"]) + 0.0001, 4)
locked_balance_stablecoin = round(float(balance_aux_stablecoin["locked"]), 4)
balance_aux_cryptocoin = client.get_asset_balance(asset=bootstrap.CRYPTOCOIN_SYMBOL)
if float(balance_aux_cryptocoin["free"]) == round(float(balance_aux_cryptocoin["free"]), 4):
balance_cryptocoin = round(float(balance_aux_cryptocoin["free"]), 4)
else:
balance_cryptocoin = round(float(balance_aux_cryptocoin["free"]) + 0.0001, 4)
locked_balance_cryptocoin = round(float(balance_aux_cryptocoin["locked"]), 4)
balance_aux_bnb = client.get_asset_balance(asset="BNB")
balance_bnb = round(float(balance_aux_bnb["free"]), 8)
locked_balance_bnb = round(float(balance_aux_bnb["locked"]), 8)
###############################################
####### FILE MANIPULATION FUNCTIONS #######
###############################################
def log_files_creation(direct_call="1"):
global current_export_dir
global RYBKA_EMAIL_RECIPIENT_EMAIL, RYBKA_EMAIL_SENDER_EMAIL, RYBKA_EMAIL_RECIPIENT_EMAIL, RYBKA_EMAIL_SENDER_EMAIL
global RYBKA_TELEGRAM_SWITCH, RYBKA_EMAIL_SWITCH
global RSI_FOR_SELL, RSI_FOR_BUY, STABLECOIN_SAFETY_NET, MIN_PROFIT, TRADE_QUANTITY, DEBUG_LVL
try:
if direct_call == "1":
os.mkdir(current_export_dir)
with open(
f"{current_export_dir}/BNB_TO_STABLECOIN_historical_prices",
"w",
encoding="utf8",
) as f:
f.write(
f"Here is a detailed view of the history of candle prices for the [BNB-{bootstrap.STABLECOIN_SYMBOL}] currency pair:\n\n"
)
with open(
f"{current_export_dir}/{TRADE_SYMBOL}_historical_prices",
"w",
encoding="utf8",
) as f:
f.write(
f"Here is a detailed view of the history of candle prices for the [{TRADE_SYMBOL}] currency pair:\n\n"
)
with open(
f"{current_export_dir}/{TRADE_SYMBOL}_order_history",
"w",
encoding="utf8",
) as f:
f.write(
f"Here is a detailed view of the history of orders done for the [{TRADE_SYMBOL}] currency pair:\n\n"
)
with open(f"{current_export_dir}/{TRADE_SYMBOL}_DEBUG", "w", encoding="utf8") as f:
f.write(f"DEBUG logs for the [{TRADE_SYMBOL}] currency pair:\n\n")
with open(f"{current_export_dir}/{TRADE_SYMBOL}_weights", "w", encoding="utf8") as f:
f.write(
f"Here is a detailed view of weights set for the [{TRADE_SYMBOL}] currency pair:\n\n"
)
f.write(f"RYBKA_MODE set to: {RYBKA_MODE:>50}\n")
if DEBUG_LVL:
f.write(f"DEBUG_LVL set to: {DEBUG_LVL:>50}")
f.write(f"TRADE SYMBOL set to: {TRADE_SYMBOL:>50}\n")
f.write(f"TRADE QUANTITY set to: {str(TRADE_QUANTITY):>50} coins per transaction\n")
f.write(f"MIN PROFIT set to: {str(MIN_PROFIT):>50} {bootstrap.STABLECOIN_SYMBOL} per transaction\n")
f.write(f"{bootstrap.STABLECOIN_SYMBOL} SAFETY NET set to: {str(STABLECOIN_SAFETY_NET):>50} {bootstrap.STABLECOIN_SYMBOL}\n")
f.write(f"RSI PERIOD set to: {RSI_PERIOD:>50} minutes\n")
f.write(f"RSI FOR BUY set to: {RSI_FOR_BUY:>50} threshold\n")
f.write(f"RSI FOR SELL set to: {RSI_FOR_SELL:>50} threshold\n")
f.write(f"EMAIL SWITCH set to: {str(RYBKA_EMAIL_SWITCH):>50}\n")
f.write(f"TELEGRAM SWITCH set to: {str(RYBKA_TELEGRAM_SWITCH):>50}\n")
if RYBKA_EMAIL_SENDER_EMAIL and RYBKA_EMAIL_RECIPIENT_EMAIL:
f.write(f"SENDER EMAIL set to: {RYBKA_EMAIL_SENDER_EMAIL:>50}\n")
f.write(f"RECIPIENT EMAIL set to: {RYBKA_EMAIL_RECIPIENT_EMAIL:>50}\n")
if direct_call == "1":
log.DEBUG(f" ✅ Files creation status - {bcolors.PURPLE}DONE")
log.DEBUG("==============================================")
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"Attempt to create local folder [{current_export_dir}] and inner files for output analysis FAILED - with error:\n{e}"
)
def rybka_mode_folder_creation():
global RYBKA_MODE
if os.path.isdir(RYBKA_MODE) is False:
try:
os.makedirs(RYBKA_MODE)
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"Attempt to create local folder for the mode in which software runs - [{RYBKA_MODE}] - FAILED with error:\n{e}"
)
def TMP_folder(folder):
if os.path.isdir(folder) is False:
try:
os.makedirs(folder)
except Exception as e:
traceback.print_exc()
log.FATAL_7(f"Attempt to create local folder [{folder}] - FAILED with error:\n{e}")
def ktbr_configuration():
global ktbr_config
global RYBKA_MODE
if exists(f"{RYBKA_MODE}/ktbr"):
with open(f"{RYBKA_MODE}/ktbr", "r", encoding="utf8") as f:
if os.stat(f"{RYBKA_MODE}/ktbr").st_size == 0:
log.INFO_BOLD(
f" ✅ [{RYBKA_MODE}/ktbr] file exists, but its content doesn't present the right format, modifying that right now"
)
f.write("{}")
else:
try:
ktbr_config = json.loads(f.read())
if len(ktbr_config):
log.INFO_BOLD(
f" ✅ [{RYBKA_MODE}/ktbr] file contains the following past transactions:\n"
)
for k, v in ktbr_config.items():
log.INFO(
f" 💳 Transaction [{k}] --- [{bcolors.OKGREEN}{bcolors.BOLD}{v[0]}{bcolors.ENDC}{bcolors.DARKGRAY}] \t {bootstrap.CRYPTOCOIN_SYMBOL} bought at price of [{bcolors.OKGREEN}{bcolors.BOLD}{v[1]}{bcolors.ENDC}{bcolors.DARKGRAY}] \t {bootstrap.STABLECOIN_SYMBOL} per {bootstrap.CRYPTOCOIN_SYMBOL}{bcolors.ENDC}"
)
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/ktbr] file contains wrong formatted content!\nFailing with error:\n{e}"
)
else:
try:
with open(f"{RYBKA_MODE}/ktbr", "w", encoding="utf8") as f:
f.write("{}")
log.INFO_BOLD(f" ✅ [{RYBKA_MODE}/ktbr] file created!")
except Exception as e:
traceback.print_exc()
log.FATAL_7(f"[{RYBKA_MODE}/ktbr] file could NOT be created!\nFailing with error:\n{e}")
if len(ktbr_config):
log.INFO(
"=========================================================================================================\n"
)
def profit_file():
global total_stablecoin_profit
global RYBKA_MODE
log.VERBOSE(
"========================================================================================================="
)
if exists(f"{RYBKA_MODE}/stablecoin_profit"):
with open(f"{RYBKA_MODE}/stablecoin_profit", "r", encoding="utf8") as f:
if os.stat(f"{RYBKA_MODE}/stablecoin_profit").st_size == 0:
log.INFO_BOLD(f" ✅ [{RYBKA_MODE}/stablecoin_profit] file exists and is empty")
else:
try:
total_stablecoin_profit = round(float(f.read()), 4)
log.VERBOSE(
f" ✅ [{RYBKA_MODE}/stablecoin_profit] file contains the following already done profit: [{bcolors.PURPLE}{total_stablecoin_profit}{bcolors.DARKGRAY}] {bootstrap.STABLECOIN_SYMBOL}"
)
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/stablecoin_profit] file contains wrong formatted content!\nFailing with error:\n{e}"
)
else:
try:
open(f"{RYBKA_MODE}/stablecoin_profit", "w", encoding="utf8").close()
log.INFO_BOLD(f" ✅ [{RYBKA_MODE}/stablecoin_profit] file created!")
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/stablecoin_profit] file could NOT be created!\nFailing with error:\n{e}"
)
log.VERBOSE(
"========================================================================================================="
)
def nr_of_trades_file():
global nr_of_trades
global RYBKA_MODE
log.DEBUG(
"========================================================================================================="
)
if exists(f"{RYBKA_MODE}/number_of_buy_trades"):
with open(f"{RYBKA_MODE}/number_of_buy_trades", "r", encoding="utf8") as f:
if os.stat(f"{RYBKA_MODE}/number_of_buy_trades").st_size == 0:
log.DEBUG(f" ✅ [{RYBKA_MODE}/number_of_buy_trades] file exists and is empty")
else:
try:
nr_of_trades = int(f.read())
log.DEBUG(
f" ✅ [{RYBKA_MODE}/number_of_buy_trades] file shows historical nr. of buy trades raising to: [{bcolors.PURPLE}{nr_of_trades}{bcolors.DARKGRAY}]"
)
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/number_of_buy_trades] file contains wrong formatted content!\nFailing with error:\n{e}"
)
else:
try:
open(f"{RYBKA_MODE}/number_of_buy_trades", "w", encoding="utf8").close()
log.DEBUG(f" ✅ [{RYBKA_MODE}/number_of_buy_trades] file created!")
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/number_of_buy_trades] file could NOT be created!\nFailing with error:\n{e}"
)
log.DEBUG(
"========================================================================================================="
)
def full_order_history_file():
global RYBKA_MODE
log.DEBUG(
"========================================================================================================="
)
if exists(f"{RYBKA_MODE}/full_order_history"):
with open(f"{RYBKA_MODE}/full_order_history", "r", encoding="utf8"):
if os.stat(f"{RYBKA_MODE}/full_order_history").st_size == 0:
log.DEBUG(f" ✅ [{RYBKA_MODE}/full_order_history] file exists and is empty")
else:
log.DEBUG(
f" ✅ [{RYBKA_MODE}/full_order_history] file exists and contains past information!"
)
else:
try:
open(f"{RYBKA_MODE}/full_order_history", "w", encoding="utf8").close()
log.DEBUG(f" ✅ [{RYBKA_MODE}/full_order_history] file created!")
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/full_order_history] file could NOT be created!\nFailing with error:\n{e}"
)
log.DEBUG(
"========================================================================================================="
)
def real_time_balances():
global RYBKA_MODE
log.DEBUG(
"========================================================================================================="
)
if exists(f"{RYBKA_MODE}/real_time_balances"):
log.DEBUG(f" ✅ [{RYBKA_MODE}/real_time_balances] file already exists!")
else:
try:
open(f"{RYBKA_MODE}/real_time_balances", "w", encoding="utf8").close()
log.DEBUG(f" ✅ [{RYBKA_MODE}/real_time_balances] file created!")
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/real_time_balances] file could NOT be created!\nFailing with error:\n{e}"
)
log.DEBUG(
"========================================================================================================="
)
def ktbr_integrity():
global balance_cryptocoin
global sum_of_ktbr_cryptocurrency
global RYBKA_MODE
ktbr_config_check = {}
sum_of_ktbr_cryptocurrency = 0
with open(f"{RYBKA_MODE}/ktbr", "r", encoding="utf8") as f:
ktbr_config_check = json.loads(f.read())
for v in ktbr_config_check.values():
sum_of_ktbr_cryptocurrency += v[0]
log.VERBOSE(f"ktbr_config_check is {ktbr_config_check}")
log.VERBOSE(f"sum_of_ktbr_cryptocurrency rounded is {round(sum_of_ktbr_cryptocurrency, 4)}")
log.VERBOSE(f"ktbr_integrity()'s [{bootstrap.CRYPTOCOIN_SYMBOL}] balance is {balance_cryptocoin}")
if round(sum_of_ktbr_cryptocurrency, 4) <= balance_cryptocoin:
log.INFO_BOLD(
f" ✅ KTBR integrity status - {bcolors.PURPLE}VALID{bcolors.DARKGRAY}\n"
)
log.INFO_BOLD(
f" ✅ Amount of {bootstrap.CRYPTOCOIN_SYMBOL} bought and tracked: [{bcolors.OKGREEN}{round(sum_of_ktbr_cryptocurrency, 4)}{bcolors.DARKGRAY}]\n"
)
else:
log.FATAL_7(
f"KTBR integrity status - INVALID\nThis means that the amount of {bootstrap.CRYPTOCOIN_SYMBOL} you have in cloud [{balance_cryptocoin}] is actually less now, than what you retain in the 'ktbr' file [{round(sum_of_ktbr_cryptocurrency, 4)}]. Probably you've spent a part of it in the meantime."
)
def all_errors_file():
global RYBKA_MODE
log.DEBUG("==============================================")
if exists(f"{RYBKA_MODE}/errors_thrown"):
log.DEBUG(f" ✅ [{RYBKA_MODE}/errors_thrown] file already exists!")
else:
try:
open(f"{RYBKA_MODE}/errors_thrown", "w", encoding="utf8").close()
log.DEBUG(f" ✅ [{RYBKA_MODE}/errors_thrown] file created!")
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{RYBKA_MODE}/errors_thrown] file could NOT be created!\nFailing with error:\n{e}"
)
log.DEBUG("==============================================")
def create_telegram_and_rybka_tmp_files_if_not_created():
if not exists("TEMP/pid_rybkaTmp") or (
exists("TEMP/pid_rybkaTmp") and os.stat("TEMP/pid_rybkaTmp").st_size == 0
):
with open("TEMP/pid_rybkaTmp", "w", encoding="utf8") as f:
f.write(str("99999999"))
if not exists("TEMP/core_runsTmp") or (
exists("TEMP/core_runsTmp") and os.stat("TEMP/core_runsTmp").st_size == 0
):
with open("TEMP/core_runsTmp", "w", encoding="utf8") as g:
g.write(str("99999999"))
if not exists("TEMP/telegram_pidTmp") or (
exists("TEMP/telegram_pidTmp") and os.stat("TEMP/telegram_pidTmp").st_size == 0
):
with open("TEMP/telegram_pidTmp", "w", encoding="utf8") as h:
h.write(str("99999999"))
###############################################
############## AUX FUNCTIONS ##############
###############################################
def back_up():
global RYBKA_MODE
back_up_dir = f"BACK_UPS_FOR_{RYBKA_MODE}"
if os.path.isdir(back_up_dir) is False:
os.makedirs(back_up_dir)
shutil.copyfile(f"{RYBKA_MODE}/ktbr", f"{back_up_dir}/ktbr")
def software_config_params():
global RYBKA_EMAIL_RECIPIENT_EMAIL, RYBKA_EMAIL_SENDER_EMAIL, RYBKA_EMAIL_SENDER_EMAIL, RYBKA_TELEGRAM_SWITCH
global RYBKA_EMAIL_SWITCH, RSI_FOR_SELL, RSI_FOR_BUY, MIN_PROFIT, STABLECOIN_SAFETY_NET, TRADE_QUANTITY, DEBUG_LVL
global TRADE_QUANTITY
print("\n\n")
if RYBKA_MODE.upper() == "DEMO":
log.PURPLE(
" ___ ___ ___ ___ ___ ___ ___ ___ ___ "
)
log.PURPLE(
" /\ \ |\__\ /\ \ /\__\ /\ \ /\ \ /\ \ /\ \ /\ \ "
)
log.PURPLE(
" /::\ \ |:| | /::\ \ /:/ / /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ "
)
log.PURPLE(
" /:/\:\ \ |:| | /:/\:\ \ /:/__/ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ "
)
log.PURPLE(
" /::\~\:\ \ |:|__|__ /::\~\:\__\ /::\__\____ /::\~\:\ \ /:/ \:\ \ /:/ \:\ \ /::\~\:\ \ /::\~\:\ \ "
)
log.PURPLE(
" /:/\:\ \:\__\ /::::\__\ /:/\:\ \:|__| /:/\:::::\__\ /:/\:\ \:\__\ /:/__/ \:\__\ /:/__/ \:\__\ /:/\:\ \:\__\ /:/\:\ \:\__\\"
)
log.PURPLE(
" \/_|::\/:/ / /:/~~/~ \:\~\:\/:/ / \/_|:|~~|~ \/__\:\/:/ / \:\ \ \/__/ \:\ \ /:/ / \/_|::\/:/ / \:\~\:\ \/__/"
)
log.PURPLE(
" |:|::/ / /:/ / \:\ \::/ / |:| | \::/ / \:\ \ \:\ /:/ / |:|::/ / \:\ \:\__\ "
)
log.PURPLE(
" |:|\/__/ \/__/ \:\/:/ / |:| | /:/ / \:\ \ \:\/:/ / |:|\/__/ \:\ \/__/ "
)
log.PURPLE(
" |:| | \::/__/ |:| | /:/ / \:\__\ \::/ / |:| | \:\__\ "
)
log.PURPLE(
" \|__| ~~ \|__| \/__/ \/__/ \/__/ \|__| \/__/ \n"
)
log.BLUE(
" ██████╗ ███████╗███╗ ███╗ ██████╗ ███╗ ███╗ ██████╗ ██████╗ ███████╗ "
)
log.BLUE(
" ██╔══██╗██╔════╝████╗ ████║██╔═══██╗ ████╗ ████║██╔═══██╗██╔══██╗██╔════╝ "
)
log.BLUE(
" ██║ ██║█████╗ ██╔████╔██║██║ ██║ ██╔████╔██║██║ ██║██║ ██║█████╗ "
)
log.BLUE(
" ██║ ██║██╔══╝ ██║╚██╔╝██║██║ ██║ ██║╚██╔╝██║██║ ██║██║ ██║██╔══╝ "
)
log.BLUE(
" ██████╔╝███████╗██║ ╚═╝ ██║╚██████╔╝ ██║ ╚═╝ ██║╚██████╔╝██████╔╝███████╗ "
)
log.BLUE(
" ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ \n\n"
)
elif RYBKA_MODE.upper() == "LIVE":
log.CYAN(
" ___ ___ ___ ___ ___ ___ ___ ___ ___ "
)
log.CYAN(
" /\ \ |\__\ /\ \ /\__\ /\ \ /\ \ /\ \ /\ \ /\ \ "
)
log.CYAN(
" /::\ \ |:| | /::\ \ /:/ / /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ "
)
log.CYAN(
" /:/\:\ \ |:| | /:/\:\ \ /:/__/ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ "
)
log.CYAN(
" /::\~\:\ \ |:|__|__ /::\~\:\__\ /::\__\____ /::\~\:\ \ /:/ \:\ \ /:/ \:\ \ /::\~\:\ \ /::\~\:\ \ "
)
log.CYAN(
" /:/\:\ \:\__\ /::::\__\ /:/\:\ \:|__| /:/\:::::\__\ /:/\:\ \:\__\ /:/__/ \:\__\ /:/__/ \:\__\ /:/\:\ \:\__\ /:/\:\ \:\__\\"
)
log.CYAN(
" \/_|::\/:/ / /:/~~/~ \:\~\:\/:/ / \/_|:|~~|~ \/__\:\/:/ / \:\ \ \/__/ \:\ \ /:/ / \/_|::\/:/ / \:\~\:\ \/__/"
)
log.CYAN(
" |:|::/ / /:/ / \:\ \::/ / |:| | \::/ / \:\ \ \:\ /:/ / |:|::/ / \:\ \:\__\ "
)
log.CYAN(
" |:|\/__/ \/__/ \:\/:/ / |:| | /:/ / \:\ \ \:\/:/ / |:|\/__/ \:\ \/__/ "
)
log.CYAN(
" |:| | \::/__/ |:| | /:/ / \:\__\ \::/ / |:| | \:\__\ "
)
log.CYAN(
" \|__| ~~ \|__| \/__/ \/__/ \/__/ \|__| \/__/ \n"
)
log.GREEN(
" ██╗ ██╗██╗ ██╗███████╗ ███╗ ███╗ ██████╗ ██████╗ ███████╗ "
)
log.GREEN(
" ██║ ██║██║ ██║██╔════╝ ████╗ ████║██╔═══██╗██╔══██╗██╔════╝ "
)
log.GREEN(
" ██║ ██║██║ ██║█████╗ ██╔████╔██║██║ ██║██║ ██║█████╗ "
)
log.GREEN(
" ██║ ██║╚██╗ ██╔╝██╔══╝ ██║╚██╔╝██║██║ ██║██║ ██║██╔══╝ "
)
log.GREEN(
" ███████╗██║ ╚████╔╝ ███████╗ ██║ ╚═╝ ██║╚██████╔╝██████╔╝███████╗ "
)
log.GREEN(
" ╚══════╝╚═╝ ╚═══╝ ╚══════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ \n\n"
)
time.sleep(1)
log.DEBUG("RybkaCore software started with the following parameters:\n")
log.INFO_BOLD(f" 🔘 RYBKA_MODE set to: {bcolors.PURPLE}{RYBKA_MODE:>50}")
if DEBUG_LVL:
log.INFO_BOLD(f"{bcolors.OKCYAN} 🔘 DEBUG_LVL set to: {DEBUG_LVL:>50}{bcolors.ENDC}")
log.INFO_BOLD(f" 🔘 TRADE SYMBOL set to: {bcolors.PURPLE}{TRADE_SYMBOL:>50}")
log.INFO_BOLD(
f" 🔘 TRADE QUANTITY set to: {bcolors.PURPLE}{str(TRADE_QUANTITY):>50}{bcolors.DARKGRAY} coins per transaction"
)
log.INFO_BOLD(
f" 🔘 MIN PROFIT set to: {bcolors.PURPLE}{str(MIN_PROFIT):>50}{bcolors.DARKGRAY} {bootstrap.STABLECOIN_SYMBOL} per transaction"
)
log.INFO_BOLD(
f" 🔘 {bootstrap.STABLECOIN_SYMBOL} SAFETY NET set to: {bcolors.PURPLE}{str(STABLECOIN_SAFETY_NET):>50}{bcolors.DARKGRAY} {bootstrap.STABLECOIN_SYMBOL}"
)
log.INFO_BOLD(
f" 🔘 RSI PERIOD set to: {bcolors.PURPLE}{RSI_PERIOD:>50}{bcolors.DARKGRAY} minutes"
)
log.INFO_BOLD(
f" 🔘 RSI FOR BUY set to: {bcolors.PURPLE}{RSI_FOR_BUY:>50}{bcolors.DARKGRAY} threshold"
)
log.INFO_BOLD(
f" 🔘 RSI FOR SELL set to: {bcolors.PURPLE}{RSI_FOR_SELL:>50}{bcolors.DARKGRAY} threshold"
)
log.INFO_BOLD(f" 🔘 EMAIL SWITCH set to: {bcolors.PURPLE}{str(RYBKA_EMAIL_SWITCH):>50}")
log.INFO_BOLD(f" 🔘 TELEGRAM SWITCH set to: {bcolors.PURPLE}{str(RYBKA_TELEGRAM_SWITCH):>50}")
if RYBKA_EMAIL_SENDER_EMAIL and RYBKA_EMAIL_RECIPIENT_EMAIL:
log.INFO_BOLD(f" 🔘 SENDER EMAIL set to: {bcolors.PURPLE}{RYBKA_EMAIL_SENDER_EMAIL:>50}")
log.INFO_BOLD(
f" 🔘 RECIPIENT EMAIL set to: {bcolors.PURPLE}{RYBKA_EMAIL_RECIPIENT_EMAIL:>50}\n\n"
)
log.INFO_BOLD(f" ✅ Initial params config - {bcolors.PURPLE}DONE")
def disclaimer():
time.sleep(1)
print("\n\n\n\t\t\t\t\t ===== DISCLAIMER! ===== \n\n\n\n\n")
time.sleep(2)
print("\t\t FOR AS LONG AS YOU INTEND TO USE THIS BOT (even when it does NOT run): \n")
time.sleep(5)
print(
f"\t ❌ DO NOT SET MANUALLY ANY OTHER ORDERS WITH THE TRADING PAIR [{TRADE_SYMBOL}]'s PARTS YOU RUN THIS BOT AGAINST! \n"
)
time.sleep(7)
print(
"\t ❌ DO NOT CONVERT THE NON-STABLE CRYPTOCOIN YOU ARE TRADING WITH INTO ANY OTHER CURRENCY; OR IF YOU DO, DELETE THE TRADING QUANTITY FROM THE KTBR FILE, TO ASSURE THE GOOD FUTURE FUNCTIONING OF THE BOT! STOP THE BOT BEFORE DOING SUCH CHANGES, RESTART IT AFTER! \n\n\n"
)
time.sleep(13)
print("\t\t YOU ARE ALLOWED TO: \n")
time.sleep(2)
print(
f"\t ✅ TOP UP WITH EITHER PARTS OF THE TRADING PAIR [{TRADE_SYMBOL}] (EVEN DURING BOT'S RUNNING, BUT ONLY THE NEW {bootstrap.STABLECOIN_SYMBOL} ADDED WILL BE CONSIDERED BY BOT TO BUY MORE). \n"
)
time.sleep(5)
print(
"\t ✅ SELL ANY QUANTITY OF THE NON-STABLE CRYPTOCOIN YOU HAD PREVIOUSLY BOUGHT, ASIDE FROM THE QUANTITY BOUGHT VIA BOT'S TRANSACTIONS (YOU CAN SELL IT EVEN DURING BOT'S RUNNING). \n\n\n"
)
time.sleep(10)
print("\t\t NOTES: \n")
time.sleep(1)
print(
"\t ⚠️ SET ENV VAR [DISCLAIMER] to 'disabled' if you DO NOT want to see this Disclaimer again! \n"
)
time.sleep(6)
print("\t ⚠️ CAPITAL AT RISK! TRADE ONLY THE CASH YOU ARE COMFORTABLE TO LOSE! \n\n\n")
time.sleep(5)
print('\t\t\t\t "TIME IN THE MARKET IS BETTER THAN TIMING THE MARKET!" - Kenneth Fisher')
time.sleep(5)
def email_engine_params(direct_call="1"):
global RYBKA_EMAIL_SENDER_EMAIL, RYBKA_EMAIL_RECIPIENT_EMAIL, RYBKA_EMAIL_RECIPIENT_NAME, RYBKA_EMAIL_SWITCH
if RYBKA_EMAIL_SWITCH.upper() == "TRUE":
if RYBKA_EMAIL_RECIPIENT_NAME == "User":
if direct_call == "1":
log.WARN(
"\n[RYBKA_EMAIL_RECIPIENT_NAME] was NOT provided in the HOST MACHINE ENV., but will default to value [User]"
)
if (
RYBKA_EMAIL_SENDER_EMAIL
and RYBKA_EMAIL_SENDER_DEVICE_PASSWORD
and RYBKA_EMAIL_RECIPIENT_EMAIL
):
if direct_call == "1":
log.INFO_BOLD(f" ✅ Email params in ENV - {bcolors.PURPLE}SET")
else:
log.FATAL_7(
"Email params in ENV - NOT SET\nAs long as you have [RYBKA_EMAIL_SWITCH] set as [True], make sure you also set up the [RYBKA_EMAIL_SENDER_EMAIL, RYBKA_EMAIL_SENDER_DEVICE_PASSWORD, RYBKA_EMAIL_RECIPIENT_EMAIL] vars in your ENV!"
)
else:
if direct_call == "1":
log.WARN(
"Emails are turned [OFF]\n"
)
log.DEBUG(
"Set [RYBKA_EMAIL_SWITCH] var as 'True' in env / config.ini. if you want email notifications enabled!"
)
def telegram_engine_switch(direct_call="1"):
global RYBKA_TELEGRAM_SWITCH
if RYBKA_TELEGRAM_SWITCH.upper() == "TRUE":
if bootstrap.TELE_KEY and bootstrap.TELE_CHAT_ID:
if direct_call == "1":
log.INFO_BOLD(f" ✅ Telegram params in ENV - {bcolors.PURPLE}SET")
else:
log.FATAL_7(
"Telegram params in ENV - NOT SET\nAs long as you have [RYBKA_TELEGRAM_SWITCH] set as [True], make sure you also set up the [RYBKA_TELEGRAM_API_KEY, RYBKA_TELEGRAM_CHAT_ID] vars in your ENV!"
)
else:
if direct_call == "1":
log.WARN(
"Telegram notifications are turned [OFF]"
)
log.DEBUG(
"Set [RYBKA_TELEGRAM_SWITCH] var as 'True' in env / config.ini. if you want Telegram notifications enabled!\n"
)
def bot_uptime_and_current_price(current_price, output):
global uptime
check_time = time.time()
uptime_seconds = round(check_time - start_time)
uptime_minutes = math.floor(uptime_seconds / 60)
uptime_hours = math.floor(uptime_minutes / 60)
seconds_in_limit = uptime_seconds % 60
minutes_in_limit = math.floor(uptime_seconds / 60) % 60
hours_in_limit = math.floor(uptime_minutes / 60) % 24
days = math.floor(uptime_hours / 24)
if output == "CLI":
if days < 1:
price_and_uptime = f"[ {bcolors.OKCYAN}{bootstrap.CRYPTOCOIN_SYMBOL}{bcolors.DARKGRAY} = {bcolors.PURPLE}{current_price:5} {bcolors.OKCYAN}{bootstrap.STABLECOIN_SYMBOL}{bcolors.DARKGRAY} ] [ ⏰ {bcolors.OKGREEN}UPTIME{bcolors.DARKGRAY} = {bcolors.PURPLE}{hours_in_limit:2}h:{minutes_in_limit:2}m:{seconds_in_limit:2}s{bcolors.DARKGRAY} ] [ 💵 {bcolors.OKGREEN}PROFIT{bcolors.DARKGRAY} = {bcolors.PURPLE}{total_stablecoin_profit} ₮{bcolors.DARKGRAY} ]"
else:
price_and_uptime = f"[ {bcolors.OKCYAN}{bootstrap.CRYPTOCOIN_SYMBOL}{bcolors.DARKGRAY} = {bcolors.PURPLE}{current_price:5} {bcolors.OKCYAN}{bootstrap.STABLECOIN_SYMBOL}{bcolors.DARKGRAY} ] [ ⏰ {bcolors.OKGREEN}UPTIME{bcolors.DARKGRAY} = {bcolors.PURPLE}{days}d {hours_in_limit:2}h:{minutes_in_limit:2}m:{seconds_in_limit:2}s{bcolors.DARKGRAY} ] [ 💵 {bcolors.OKGREEN}PROFIT{bcolors.DARKGRAY} = {bcolors.PURPLE}{total_stablecoin_profit} ₮{bcolors.DARKGRAY} ]"
log.INFO(price_and_uptime)
elif output == "Telegram":
if days < 1:
return f"{hours_in_limit:2}h:{minutes_in_limit:2}m:{seconds_in_limit:2}s"
return f"{days}d {hours_in_limit:2}h:{minutes_in_limit:2}m:{seconds_in_limit:2}s"
def email_sender(email_message):
global RYBKA_EMAIL_SWITCH, RYBKA_EMAIL_RECIPIENT_EMAIL, RYBKA_EMAIL_SENDER_EMAIL, RYBKA_EMAIL_RECIPIENT_NAME
email_engine_params("0")
if RYBKA_EMAIL_SWITCH.upper() == "TRUE":
message_template = Template(
"""Dear ${PERSON_NAME},
${MESSAGE}
================================================================
Email sent by RYBKA bot from machine having the following specs:
hostname ${HOSTNAME}
mac-address ${MAC_ADDR}
================================================================"""
)
s = smtplib.SMTP(host="smtp.gmail.com", port=587)
s.starttls()
try:
s.login(RYBKA_EMAIL_SENDER_EMAIL, RYBKA_EMAIL_SENDER_DEVICE_PASSWORD)
except Exception as e:
log.FATAL_7(
f"Email credentials got rejected. Please verify their validity and check the error thrown, below:\n\n{e}\n\n"
)
msg = MIMEMultipart()
message = message_template.substitute(
PERSON_NAME=RYBKA_EMAIL_RECIPIENT_NAME.title(),
MESSAGE=email_message,
HOSTNAME=socket.gethostname(),
MAC_ADDR=":".join(re.findall("..", "%012x" % uuid.getnode())),
)
msg["From"] = RYBKA_EMAIL_SENDER_EMAIL
msg["To"] = RYBKA_EMAIL_RECIPIENT_EMAIL
msg["Subject"] = "RYBKA notification"
msg.attach(MIMEText(message, "plain"))
try:
s.send_message(msg)
except Exception as e:
log.WARN(
f"Sending email notification failed with error:\n{e}\nIf it's an authentication issue and you did set the correct password for your gmail account, you have the know that the actual required one is the DEVICE password for your gmail.\nIf you haven't got one configured yet, please set one up right here (connect with your sender address and then replace the password in the ENV with the newly created device password:\n https://myaccount.google.com/apppasswords"
)
del msg
s.quit()
def clear_terminal():
if platform == "linux" or platform == "linux2":
os.system("clear")
elif platform == "win32":
os.system("cls")
def re_sync_time():
global DEBUG_LVL
try:
if platform == "linux" or platform == "linux2":
pass
elif platform == "win32":
if DEBUG_LVL == 2 or DEBUG_LVL == 3:
subprocess.call(["net", "start", "w32time"])
subprocess.call(
[
"w32tm",
"/config",
"/syncfromflags:manual",
"/manualpeerlist:time.nist.gov",
]
)
subprocess.call(["w32TM", "/resync"])
else:
devnull = open(os.devnull, "w", encoding="utf-8")
subprocess.call(["net", "start", "w32time"], stdout=devnull, stderr=devnull)
subprocess.call(
[
"w32tm",
"/config",
"/syncfromflags:manual",
"/manualpeerlist:time.nist.gov",
],
stdout=devnull,
stderr=devnull,
)
subprocess.call(["w32TM", "/resync"], stdout=devnull, stderr=devnull)
log.DEBUG("Time SYNC cmd completed successfully OR time is already synced")
except Exception as e:
log.WARN(f"Time SYNC cmd DID NOT complete successfully:\n{e}")
def isAdmin():
try:
is_admin = os.getuid() == 0
except AttributeError:
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
return is_admin
def real_time_balances_update():
global RYBKA_MODE
global balance_stablecoin
global balance_cryptocoin
global balance_bnb
try:
with open(f"{RYBKA_MODE}/real_time_balances", "w", encoding="utf8") as f:
f.write(f"Binance Account shows the following balances ({bootstrap.CRYPTOCOIN_SYMBOL}, {bootstrap.STABLECOIN_SYMBOL} and BNB only):\n")
f.write(f"\n{log.logging_time()} {bootstrap.CRYPTOCOIN_SYMBOL} balance is: {balance_cryptocoin}")
f.write(f"\n{log.logging_time()} {bootstrap.STABLECOIN_SYMBOL} balance is: {balance_stablecoin}")
f.write(f"\n{log.logging_time()} BNB balance is: {balance_bnb}")
f.write(f"\n 🔶 Only [[{round(sum_of_ktbr_cryptocurrency, 4)}]] {bootstrap.CRYPTOCOIN_SYMBOL}s are tracked by bot, out of [[{balance_cryptocoin}]]")
except Exception as e:
log.WARN(f"Could not update balance file due to error: \n{e}")
def previous_runs_sanitation(target_folder):
pattern = r".*_.*_.*_.*_.*_.*_.*_.*_.*_.*"
folders = [f for f in os.listdir(".") if os.path.isdir(f)]
found_match = False
for folder in folders:
if re.match(pattern, folder):
found_match = True
shutil.move(folder, target_folder)
if found_match:
log.VERBOSE(" ✅ Previous run(s)' folder(s) found and moved to the 'archived_logs' folder.")
else:
log.VERBOSE(" ✅ Current dir is already sanitized.")
def move_and_replace(target_folder, path=None):
original_dir = os.getcwd()
if path:
os.chdir(path)
with open(target_folder, encoding="utf-8") as f:
num_lines = sum(1 for line in f)
if num_lines > 10000:
if path:
log.INFO(
f"File [{path}/{target_folder}] reached more than 10k lines. Archiving it and creating a fresher one."
)
else:
log.INFO(
f"File [./{target_folder}] reached more than 10k lines. Archiving it and creating a fresher one."
)
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
filename, extension = os.path.splitext(target_folder)
new_filename = f"{filename}_{timestamp}{extension}"
archive_path = os.path.join(os.getcwd(), "archive")
if not os.path.exists(archive_path):
os.makedirs(archive_path)
shutil.move(target_folder, os.path.join(archive_path, new_filename))
with open(target_folder, "w", encoding="utf-8") as f:
f.write("")
if path:
os.chdir(original_dir)
###############################################
########### WEBSOCKET FUNCTIONS ###########
###############################################
@click.command()
@click.option(
"--mode",
"-m",
type=click.Choice(["demo", "live"], case_sensitive=False),
help="Choose the run mode of the software",
)
@click.option("--version", is_flag=True, help="Show the version of the software", required=False)
@click.option("--head", is_flag=True, help="Show the version of the software", required=False)
def main(version, mode, head):
"""\b
\b#################################################################################
\b### 🔸 RYBKACORE Software 🔸 ###
\b### ###
\b### 📖 Docs: https://gitlab.com/Silviu_space/rybka/-/blob/master/README.md ###
\b#################################################################################
\b### ###
\b### 🔹 Author: ©️ Silviu-Iulian Muraru ###
\b### 🔹 Email: [email protected] ###
\b### 🔹 LinkedIn: https://www.linkedin.com/in/silviu-muraru-iulian/ ###
\b### ###
\b#################################################################################
"""
###############################################
########### CLI ARGS MANAGEMENT ###########
###############################################
global RYBKA_MODE, DEBUG_LVL
global RSI_PERIOD, RSI_FOR_BUY, RSI_FOR_SELL
global TRADING_BOOST_LVL, TRADE_QUANTITY, TRADE_SYMBOL, AUX_TRADE_QUANTITY
global STABLECOIN_SAFETY_NET, MIN_PROFIT
global RYBKA_TELEGRAM_SWITCH
global RYBKA_ALL_LOG_TLG_SWITCH
global RYBKA_BALANCES_AUX
global SET_DISCLAIMER
global ALLOW_ONLY_BUYS, ALLOW_ONLY_SELLS
global balance_stablecoin, balance_cryptocoin, balance_bnb
global locked_balance_stablecoin, locked_balance_cryptocoin, locked_balance_bnb
global total_stablecoin_profit
global current_export_dir, archived_logs_folder
global uptime, start_time
global client, closed_candles
global ktbr_config
global bnb_commission
global multiple_sells, nr_of_trades
global subsequent_valid_rsi_counter
global archived_logs_folder, current_export_dir
# In need of a dummy value for the case where the candle closes for the main trading-pair before it got closed for the BNB-stablecoin pair, hence the value is not attributed to the BNB side, but only after up to 1 more minute
global bnb_candle_close_price, bnb_conversion_done
bnb_candle_close_price = 0
bnb_conversion_done = 0
if not version and not mode and not head:
click.echo(click.get_current_context().get_help())
sys.exit(111)
if version:
print(f"🔍 RybkaCore Software Version ➜ [{bootstrap.__version__}]")
sys.exit(111)
if mode and head:
RYBKA_MODE = mode.upper()
# in need for the logging.py module
os.environ["RYBKA_MODE"] = RYBKA_MODE
if RYBKA_MODE == "DEMO":
balance_stablecoin = bootstrap.RYBKA_DEMO_BALANCE_STABLECOIN
balance_cryptocoin = bootstrap.RYBKA_DEMO_BALANCE_CRYPTOCOIN
balance_bnb = bootstrap.RYBKA_DEMO_BALANCE_BNB
elif RYBKA_MODE == "LIVE":
balance_stablecoin = 0
balance_cryptocoin = 0
balance_bnb = 0
locked_balance_stablecoin = 0
locked_balance_cryptocoin = 0
locked_balance_bnb = 0
else:
sys.exit(0)
###############################################
########### FUNCTIONS' SEQUENCE ###########
###############################################
try:
archived_logs_folder = "archived_logs"
TMP_folder(archived_logs_folder)
except Exception as e:
traceback.print_exc()
log.FATAL_7(
f"[{archived_logs_folder}] folder could not be created. Reason for failure:\n{e}"
)
try:
previous_runs_sanitation(archived_logs_folder)
except Exception as e:
traceback.print_exc()
log.FATAL_7(f"[SANITATION] process failed. Reason for failure:\n{e}")
if platform == "linux" or platform == "linux2":
pass
elif platform == "win32":
log.VERBOSE(
"\n 📋 Checking Rybka's permissions and syncing time... Please wait!"
)
if isAdmin() is not True:
log.FATAL_7(
"Please run the script with admin privileges, as bot needs access to auto-update HOST's time with NIST servers!"
)
re_sync_time()
########### Prerequisites - start ###########
log.VERBOSE("\n 📋 PREREQUISITE PROCESS STARTING...\n")
process_pid = os.getpid()