-
Notifications
You must be signed in to change notification settings - Fork 125
/
run.py
135 lines (122 loc) · 5.93 KB
/
run.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
import subprocess
from exchange_config import *
import sys, os
sys.stdin.reconfigure(encoding="utf-8")
sys.stdout.reconfigure(encoding="utf-8")
import time
from os import name,system
from colorama import Style, Fore, init
init()
def clear():
if name == 'nt':
system('cls')
else:
system('clear')
try:
if len(sys.argv) < 3:
input_list = ["mode (fake-money or real)", "renewal period (in minutes)", "balance to use", "pair", "exchanges list separated without space with commas (,)"]
if not renewal:
input_list.remove("renewal period (in minutes)")
output = []
for inputt in input_list:
output.append(input(inputt+" >>> "))
mode = output[0]
if not renewal:
renew_time = "525600"
balance=output[1]
pair = output[2]
ex_list = output[3]
else:
renew_time = output[1]
balance=output[2]
pair = output[3]
ex_list = output[4]
if mode!='fake-money':
real_balance=0
for ex_str in ex_list.split(','):
bal = ex[ex_str].fetchBalance()
real_balance+=float(bal[pair.split('/')[1]]['total'])
with open(f"real_balance.txt","w") as f:
f.write(str(real_balance))
if renewal:
subprocess.run([python_command,f"main.py",mode,renew_time,balance,pair,ex_list])
else:
subprocess.run([python_command,f"main.py",mode,balance,pair,ex_list])
else:
if (len(sys.argv) != 6) and renewal:
printerror(m=f"Not correctly configured. Usage:\n \n{python_command} run.py <mode> <renewal period minutes> <balance to use> <crypto pair> <exchanges list separated without space with commas (,)>\n")
sys.exit(1)
if (len(sys.argv) != 5) and not renewal:
printerror(m=f"Not correctly configured. Usage:\n \n{python_command} run.py <mode> <balance to use> <crypto pair> <exchanges list separated without space with commas (,)>\n")
sys.exit(1)
args = sys.argv
mode = args[1]
if not renewal:
renew_time = "525600"
balance=args[2]
pair = args[3]
ex_list = args[4]
else:
renew_time = args[2]
balance=args[3]
pair = args[4]
ex_list = args[5]
if mode!='fake-money':
real_balance=0
for ex_str in ex_list.split(','):
bal = ex[ex_str].fetchBalance()
real_balance+=float(bal[pair.split('/')[1]]['total'])
with open(f"real_balance.txt","w") as f:
f.write(str(real_balance))
else:
with open(f"real_balance.txt","w") as f:
f.write(str(balance))
print('''
VMA""YMM `7MM"""Yp, db `7MM"""Mq. `7MM"""Yp, .g8""8q. MMP""MM""YMM `7MMF'`7MN. `7MF'`7MM"""YMM
VMA `7 MM Yb ;MM: MM `MM. MM Yb .dP' `YM.P' MM `7 MM MMN. M MM `7
VMA MM dP ,V^MM. MM ,M9 MM dP dM' `MM MM MM M YMb M MM d
XV MM"""bg. ,M `MM MMmmdM9 MM"""bg. MM MM MM MM M `MN. M MMmmMM
AV , MM `Y AbmmmqMA MM YM. MM `Y MM. ,MP MM MM M `MM.M MM Y ,
AV ,M MM ,9 A' VML MM `Mb. MM ,9 `Mb. ,dP' MM MM M YMM MM ,M
AMMMMMMMF .JMMmmmd9 .AMA. .AMMA..JMML. .JMM..JMMmmmd9 `"bmmd"' .JMML. .JMML..JML. YM .JMMmmmmMMM
''')
print(f" \n{Fore.BLUE}{Style.BRIGHT}DEMO VERSION{Style.RESET_ALL}\n \n\nTwitter: @thebarbotine\nDiscord: https://barbotine.xyz/discord\n")
i=0
while True:
with open(f"real_balance.txt","r") as f:
balance = str(f.read())
if i>=1 and p.returncode==1:
sys.exit(1)
if mode == "fake-money":
if os.path.exists('bot-fake-money.py'):
p=subprocess.run([python_command,"bot-fake-money.py",pair,balance,renew_time,pair,ex_list])
else:
printerror(m=f'please put the file "bot-fake-money.py" in the current directory.')
elif mode == "real":
if os.path.exists('bot.py'):
p=subprocess.run([python_command,"bot.py",pair,balance,renew_time,pair,ex_list])
else:
printerror(m=f'please put the file "bot.py" in the current directory.')
else:
printerror(m=f"mode input is incorrect.")
sys.exit(1)
i+=1
except KeyboardInterrupt:
if mode!='fake-money':
print(" \n \n \n")
clear()
answered = False
while answered == False:
inp = input(f"{get_time()} CTRL+C was pressed. Do you want to sell all crypto back? (y)es / (n)o\n \ninput: ")
append_new_line('logs/logs.txt',f"{get_time_blank()} INFO: ctrl+c was pressed.")
if inp.lower() == "y" or inp.lower() == "yes":
answered = True
emergency_convert_list(pair,[ex_list.split(',')[i] for i in range(len(ex_list.split(',')))])
sys.exit(1)
if inp.lower() == "n" or inp.lower() == "no":
answered = True
sys.exit(1)
else:
answered = False
else:
pass