forked from kcb0126/PumpBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPoloniexBot.py
244 lines (243 loc) · 17.7 KB
/
PoloniexBot.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
import json as OO00OOOO000000O0O #line:8
import requests as O0O0000OO000O0O00 #line:9
from time import strftime as OO00OO000O00O000O ,gmtime as O0000OO000OO0OOO0 #line:10
import time as OOO0O0O0O0OO00OO0 #line:11
import platform as OO000OOO00O0O0000 #line:12
import hmac as OOO0O00O0OO0O0OO0 #line:13
import hashlib as OO0OO0O000O000O00 #line:14
import pdb as OO0O000O00O00OO00 #line:15
import random as O00OO000OO000OOO0 #line:16
import urllib3 as OOO0OOOOOOOOO0O00 #line:17
import urllib as O00O00OO00O0000OO #line:18
import utils as O0O0O00OOOOOO0O0O #line:19
import colorama as O00OO00OOOOO0OO0O #line:20
O00O00OO00O0000OO =__import__ ('urllib.request',globals (),locals ())#line:21
try :#line:22
from urllib import urlencode as O0O0000OOOOO0OO00 #line:23
from urlparse import urljoin as OOO0OOOO000O0OO00 #line:24
except ImportError :#line:25
from urllib .parse import urlencode as O0O0000OOOOO0OO00 #line:26
from urllib .parse import urljoin as OOO0OOOO000O0OO00 #line:27
import configparser as OO0O000OO0O0OO000 #line:28
import sys as OO00OOO0OO00OO000 #line:29
config =OO0O000OO0O0OO000 .ConfigParser ()#line:30
config .readfp (open ('config.txt'))#line:31
key =config .get ('Poloniex','Key')#line:32
secret =config .get ('Poloniex','Secret')#line:33
secret =bytes (secret ,'utf8')#line:34
BuyPercent =config .get ('PriceLip','BuyPercent')#line:35
SellPercent =config .get ('PriceLip','SellPercent')#line:36
BuyPercent ,SellPercent =O0O0O00OOOOOO0O0O .percentageFix (BuyPercent ,SellPercent )#line:37
def make_nonce ():#line:40
return str (O00OO000OO000OOO0 .randint (931290887. ,1000000000 ))#line:41
def getTicker (O000O000000000O0O ):#line:43
OO0O00OO0O0O0OOOO ='https://poloniex.com/public?command=returnTicker'#line:44
O000O0OOO000OOO0O =O0O0000OO000O0O00 .get (OO0O00OO0O0O0OOOO )#line:45
OO0000OO0OO0O000O =OO00OOOO000000O0O .loads (O000O0OOO000OOO0O .text )#line:46
O00O0O0O00OOO0O0O =OO0000OO0OO0O000O ['BTC_'+O000O000000000O0O ]#line:47
return O00O0O0O00OOO0O0O ['lowestAsk']#line:48
def getBalance (OOOOOO000O0OOO00O ):#line:50
O0O00000O00O0000O ={}#line:51
O0O00000O00O0000O ['command']='returnBalances'#line:52
O0O00000O00O0000O ['nonce']=int (OOO0O0O0O0OO00OO0 .time ()*1000 )#line:53
OOO00000O0OO0O000 =O0O0000OOOOO0OO00 (O0O00000O00O0000O )#line:54
O0O0O0O00O0O0OOO0 =OOO0O00O0OO0O0OO0 .new (secret ,OOO00000O0OO0O000 .encode ('utf8'),OO0OO0O000O000O00 .sha512 ).hexdigest ()#line:55
OOOOO000000OO000O ={'Content-Type':'application/x-www-form-urlencoded','Key':key ,'Sign':O0O0O0O00O0O0OOO0 }#line:58
OOO00O00OOO00O000 =O0O0000OO000O0O00 .post ('https://poloniex.com/tradingApi',data =O0O00000O00O0000O ,headers =OOOOO000000OO000O )#line:59
OOOO00OO0000O0O00 =OO00OOOO000000O0O .loads (OOO00O00OOO00O000 .text )#line:60
return OOOO00OO0000O0O00 [OOOOOO000O0OOO00O ]#line:61
def getOrder (O0OOO0000OOO0O0OO ):#line:65
O0OO00OO00000O0OO ={}#line:66
O0OO00OO00000O0OO ['command']='returnTradeHistory'#line:67
O0OO00OO00000O0OO ['currencyPair']='BTC_'+O0OOO0000OOO0O0OO #line:68
O0OO00OO00000O0OO ['nonce']=int (OOO0O0O0O0OO00OO0 .time ()*1000 )#line:69
OO0OOOOOO0OOOOO0O =O0O0000OOOOO0OO00 (O0OO00OO00000O0OO )#line:70
O00O0OO0O0OOOO0OO =OOO0O00O0OO0O0OO0 .new (secret ,OO0OOOOOO0OOOOO0O .encode ('utf8'),OO0OO0O000O000O00 .sha512 ).hexdigest ()#line:71
OOOO0O0000O00OOOO ={'Content-Type':'application/x-www-form-urlencoded','Key':key ,'Sign':O00O0OO0O0OOOO0OO }#line:74
O000O00O000O00OO0 =O0O0000OO000O0O00 .post ('https://poloniex.com/tradingApi',data =O0OO00OO00000O0OO ,headers =OOOO0O0000O00OOOO )#line:75
OO0OO00O0O000O0O0 =OO00OOOO000000O0O .loads (O000O00O000O00OO0 .text )#line:76
return OO0OO00O0O000O0O0 #line:77
def buyOrder (O0OOO0O0OOO0O0OOO ,OO00OOO000O0O0OOO ):#line:80
O0000O0OOOOOO0000 =getTicker (O0OOO0O0OOO0O0OOO )#line:81
O0O0OOOO0OO00O0O0 =float (O0000O0OOOOOO0000 )*(1 +float (BuyPercent ))#line:82
OO000O00O0O0O000O ={}#line:83
OO000O00O0O0O000O ['nonce']=int (OOO0O0O0O0OO00OO0 .time ()*1000 )#line:84
OO000O00O0O0O000O ['currencyPair']='BTC_'+O0OOO0O0OOO0O0OOO #line:85
OO000O00O0O0O000O ['command']='buy'#line:86
OO000O00O0O0O000O ['rate']=str (O0O0OOOO0OO00O0O0 )#line:87
OO000O00O0O0O000O ['amount']=OO00OOO000O0O0OOO #line:88
O0000O00OO0OO00O0 =O0O0000OOOOO0OO00 (OO000O00O0O0O000O )#line:89
O0OOOO0O00O00OO00 =OOO0O00O0OO0O0OO0 .new (secret ,O0000O00OO0OO00O0 .encode ('utf8'),OO0OO0O000O000O00 .sha512 ).hexdigest ()#line:90
OOOOOOO000OO0O000 ={'Content-Type':'application/x-www-form-urlencoded','Key':key ,'Sign':O0OOOO0O00O00OO00 }#line:93
O00O0000000OO0O00 =O0O0000OO000O0O00 .post ('https://poloniex.com/tradingApi',data =OO000O00O0O0O000O ,headers =OOOOOOO000OO0O000 )#line:94
O0OOO0000OO0O0OO0 =OO00OOOO000000O0O .loads (O00O0000000OO0O00 .text )#line:95
if 'error'in O0OOO0000OO0O0OO0 :#line:96
print (O0OOO0000OO0O0OO0 )#line:97
return #line:98
else :#line:99
O000OO0OO000OO0O0 =O0OOO0000OO0O0OO0 ['resultingTrades'][0 ]['tradeID']#line:101
O0OOOOO0O0OOO000O =[O000OO0OO000OO0O0 ,O0O0OOOO0OO00O0O0 ]#line:102
return O0OOOOO0O0OOO000O #line:103
def sellOrder (OO000O00OO0OO0000 ,OO0000OOO00OO00O0 ):#line:106
OOO0O0O00O0O0O00O =getBalance (OO000O00OO0OO0000 )#line:107
OO000OO0OOOOO0O00 ={}#line:108
OO000OO0OOOOO0O00 ['nonce']=int (OOO0O0O0O0OO00OO0 .time ()*1000 )#line:109
OO000OO0OOOOO0O00 ['currencyPair']='BTC_'+OO000O00OO0OO0000 #line:110
OO000OO0OOOOO0O00 ['command']='sell'#line:111
OO000OO0OOOOO0O00 ['rate']=OO0000OOO00OO00O0 #line:112
OO000OO0OOOOO0O00 ['amount']=OOO0O0O00O0O0O00O #line:113
O00O0O0OO0OOO0000 =O0O0000OOOOO0OO00 (OO000OO0OOOOO0O00 )#line:114
OO0O0OO00O00OOOOO =OOO0O00O0OO0O0OO0 .new (secret ,O00O0O0OO0OOO0000 .encode ('utf8'),OO0OO0O000O000O00 .sha512 ).hexdigest ()#line:115
OO00O00OOO000O000 ={'Content-Type':'application/x-www-form-urlencoded','Key':key ,'Sign':OO0O0OO00O00OOOOO }#line:118
O000O0OOOO0O0OO00 =O0O0000OO000O0O00 .post ('https://poloniex.com/tradingApi',data =OO000OO0OOOOO0O00 ,headers =OO00O00OOO000O000 )#line:119
OOOO0000O0OO00000 =OO00OOOO000000O0O .loads (O000O0OOOO0O0OO00 .text )#line:120
return OOOO0000O0OO00000 ['resultingTrades'][0 ]['tradeID']#line:121
def marketHistory (OO000O00O00000O00 ):#line:124
OOOOO0OO00OOO00OO ='BTC_'+OO000O00O00000O00 #line:125
OOO0000O0O000000O =' https://poloniex.com/public?command=returnTradeHistory¤cyPair='+OOOOO0OO00OOO00OO #line:126
O0O00OO00O0OOO0OO =O0O0000OO000O0O00 .get (OOO0000O0O000000O )#line:127
O000000O00O0OOO0O =OO00OOOO000000O0O .loads (O0O00OO00O0OOO0OO .text )#line:128
OO00000OO0OOO0O0O =[]#line:129
O0000O0O0OOO0OOO0 =[]#line:130
for OO0O0000O00000O00 in O000000O00O0OOO0O :#line:131
if OO0O0000O00000O00 ['type']=='buy':#line:132
OO00000OO0OOO0O0O .append (OO0O0000O00000O00 ['rate'])#line:133
O0000O0O0OOO0OOO0 .append (OO0O0000O00000O00 ['date'])#line:134
OO0O00O0O0O0OOO0O =O0000O0O0OOO0OOO0 [0 ]#line:136
OOOOOOOO0O0OOO00O =OO0O00O0O0O0OOO0O [14 :16 ]#line:137
O000000OOO0OO0000 =0 #line:138
O0OO0O00OOOOOOOOO =0 #line:139
for OO0O0000O00000O00 in O0000O0O0OOO0OOO0 :#line:140
if float (OO0O0000O00000O00 [14 :16 ])==float (OOOOOOOO0O0OOO00O )-1 :#line:141
O000000OOO0OO0000 =O0000O0O0OOO0OOO0 .index (OO0O0000O00000O00 )#line:142
O0OO0O00OOOOOOOOO =OO00000OO0OOO0O0O [O000000OOO0OO0000 ]#line:143
break #line:144
O000OO0OO0OO0OOO0 =0 #line:146
OOOOO0OO00O000000 =0 #line:147
for OO0O0000O00000O00 in O0000O0O0OOO0OOO0 :#line:148
if float (OO0O0000O00000O00 [14 :16 ])==float (OOOOOOOO0O0OOO00O )-2 :#line:149
O000OO0OO0OO0OOO0 =O0000O0O0OOO0OOO0 .index (OO0O0000O00000O00 )#line:150
OOOOO0OO00O000000 =OO00000OO0OOO0O0O [O000OO0OO0OO0OOO0 ]#line:151
break #line:152
print (O0OO0O00OOOOOOOOO ,OOOOO0OO00O000000 )#line:154
def USD_BTC_Price ():#line:157
O0OO0OOOOOO0O0O00 ='https://poloniex.com/public?command=returnTicker'#line:158
OOO0O0OO0O0O0000O =O0O0000OO000O0O00 .get (O0OO0OOOOOO0O0O00 )#line:159
OO0OO00OOO0000OO0 =OO00OOOO000000O0O .loads (OOO0O0OO0O0O0000O .text )#line:160
O0OO000OOOOOOOOO0 =OO0OO00OOO0000OO0 ['USDT_BTC']#line:161
return O0OO000OOOOOOOOO0 ['last']#line:162
def Trade (OOO000000000O00O0 ,OO0O0O000000OO0O0 ,OO0O0O000O0OOOO00 ,O00O000000OO0O00O ):#line:165
OOOO00OO0OOO0OOOO =O00OO00OOOOO0OO0O .Fore .YELLOW +O00OO00OOOOO0OO0O .Back .BLUE +'['#line:166
OO0OO0O0O0OOOOOO0 =']'+O00OO00OOOOO0OO0O .Style .RESET_ALL +' '#line:167
O000OOO0OOOO0O0OO =O00OO00OOOOO0OO0O .Fore .YELLOW #line:168
O0O00000O00OO0OO0 =O00OO00OOOOO0OO0O .Style .RESET_ALL #line:169
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Symbol: '+O0O00000O00OO0OO0 +OOO000000000O00O0 )#line:170
OOOO0OOOO0OOOOO00 =getTicker (OOO000000000O00O0 )#line:171
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Current Price: '+O0O00000O00OO0OO0 +'%.8f'%float (OOOO0OOOO0OOOOO00 ))#line:172
OOOO0O0OOOOOOO00O =float (USD_BTC_Price ())#line:173
OOOOO0O0OOO0000OO =float (OO0O0O000O0OOOO00 )*OOOO0O0OOOOOOO00O #line:174
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Amount to use: '+O0O00000O00OO0OO0 +'%.8f'%OO0O0O000O0OOOO00 +' | $%.2f'%OOOOO0O0OOO0000OO )#line:175
O0O000O0OO0O0O000 =OO0O0O000O0OOOO00 /float (OOOO0OOOO0OOOOO00 )#line:176
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Amount To Purchase: '+O0O00000O00OO0OO0 +'%.8f'%O0O000O0OO0O0O000 )#line:177
print ('------------------------------------'+O0O00000O00OO0OO0 )#line:178
print (' ')#line:179
if float (O00O000000OO0O00O )!=0 :#line:181
O0O0O0OO0OO000O0O ,O0O0OO0OOO00O000O =marketHistory (OOO000000000O00O0 )#line:182
OO0000OOO0000OO00 =config .get ('RiskMultiplier',O00O000000OO0O00O )#line:183
O0O000OOO0000O000 =O0O0O0OO0OO000O0O *float (OO0000OOO0000OO00 )#line:184
O0O0O000OO000O00O =O0O0OO0OOO00O000O *float (OO0000OOO0000OO00 )#line:185
if O0O0O0OO0OO000O0O !=0 and OOOO0OOOO0OOOOO00 +OOOO0OOOO0OOOOO00 *float (OO0O0O000000OO0O0 )>=O0O000OOO0000O000 :#line:186
print ('Buy conditions not met, canceling order.')#line:187
print ('price 1')#line:188
OO00OO0O0O0OOO0O0 =OOOO0OOOO0OOOOO00 *OOOO0O0OOOOOOO00O #line:189
print ('Last Price: BTC '+'%.8f'%OOOO0OOOO0OOOOO00 +' | $'+'%.2f'%OO00OO0O0O0OOO0O0 )#line:190
OOO0O0O0O0000O000 =OOOO0OOOO0OOOOO00 +OOOO0OOOO0OOOOO00 *float (OO0O0O000000OO0O0 )#line:191
O0O00O0O0OOOO0000 =OOO0O0O0O0000O000 *OOOO0O0OOOOOOO00O #line:192
print ('Potential Sell Price: BTC '+'%.2f'%OOO0O0O0O0000O000 +' | $'+'%.2f'%O0O00O0O0OOOO0000 )#line:193
OO000OO00OO00OO0O =O0O000OOO0000O000 *OOOO0O0OOOOOOO00O #line:194
print ('Price Limit: BTC '+'%.8f'%O0O000OOO0000O000 +' | $'+'%.2f'%OO000OO00OO00OO0O )#line:195
OOOO00OO0OOO0OOOO =getTicker (OOO000000000O00O0 )#line:196
OOOO0O0000OO0O00O =OOOO00OO0OOO0OOOO *OOOO0O0OOOOOOO00O #line:197
print ('Current Price: BTC '+'%.8f'%OOOO00OO0OOO0OOOO +' | $'+'%.2f'%OOOO0O0000OO0O00O )#line:198
return #line:199
if O0O0OO0OOO00O000O !=0 and OOOO0OOOO0OOOOO00 +OOOO0OOOO0OOOOO00 *float (OO0O0O000000OO0O0 )>=O0O0O000OO000O00O :#line:202
print ('Buy conditions not met, canceling order.')#line:203
print ('price 2')#line:204
OO00OO0O0O0OOO0O0 =OOOO0OOOO0OOOOO00 *OOOO0O0OOOOOOO00O #line:205
print ('Last Price: BTC '+'%.8f'%OOOO0OOOO0OOOOO00 +' | $'+'%.2f'%OO00OO0O0O0OOO0O0 )#line:206
OOO0O0O0O0000O000 =OOOO0OOOO0OOOOO00 +OOOO0OOOO0OOOOO00 *float (OO0O0O000000OO0O0 )#line:207
O0O00O0O0OOOO0000 =OOO0O0O0O0000O000 *OOOO0O0OOOOOOO00O #line:208
print ('Potential Sell Price: BTC '+'%.2f'%OOO0O0O0O0000O000 +' | $'+'%.2f'%O0O00O0O0OOOO0000 )#line:209
OO000OO00OO00OO0O =O0O000OOO0000O000 *OOOO0O0OOOOOOO00O #line:210
print ('Price Limit: BTC '+'%.8f'%O0O000OOO0000O000 +' | $'+'%.2f'%OO000OO00OO00OO0O )#line:211
OOOO00OO0OOO0OOOO =getTicker (OOO000000000O00O0 )#line:212
OOOO0O0000OO0O00O =OOOO00OO0OOO0OOOO *OOOO0O0OOOOOOO00O #line:213
print ('Current Price: BTC '+'%.8f'%OOOO00OO0OOO0OOOO +' | $'+'%.2f'%OOOO0O0000OO0O00O )#line:214
return #line:215
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Placing Order...')#line:217
O0OOOOO0OOOOO0OO0 =buyOrder (OOO000000000O00O0 ,O0O000O0OO0O0O000 )#line:218
O0OO00OO000O0OO0O =getOrder (OOO000000000O00O0 )#line:219
for O0OO00O0OO0OOO000 in O0OO00OO000O0OO0O :#line:220
if O0OO00O0OO0OOO000 ['tradeID']==O0OOOOO0OOOOO0OO0 [0 ]:#line:221
OO000O0000OO0O0OO =float (O0OO00O0OO0OOO000 ['rate'])#line:222
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Order Successful!')#line:223
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Price: '+O0O00000O00OO0OO0 +'%.8f'%OO000O0000OO0O0OO )#line:224
print ('------------------------------------')#line:225
print (' ')#line:226
O0OO0O000000O0O0O =OO000O0000OO0O0OO *float (OO0O0O000000OO0O0 )#line:229
O00O0000O00OOOOOO =OO000O0000OO0O0OO +O0OO0O000000O0O0O #line:230
O000O0OOOOOOOO00O =O00O0000O00OOOOOO /(1 +float (SellPercent ))#line:231
O0OOOO0000OOOO0O0 =sellOrder (OOO000000000O00O0 ,O000O0OOOOOOOO00O )#line:232
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Sell Order Placed!')#line:233
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Price: '+O0O00000O00OO0OO0 +'%.8f'%O000O0OOOOOOOO00O )#line:234
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Patiently Waiting...'+O0O00000O00OO0OO0 )#line:235
OO00O0O0O00O0O000 =True #line:236
while OO00O0O0O00O0O000 :#line:237
O0OO00OO000O0OO0O =getOrder (OOO000000000O00O0 )#line:238
for O0OO00O0OO0OOO000 in O0OO00OO000O0OO0O :#line:240
if O0OO00O0OO0OOO000 ['tradeID']==O0OOOO0000OOOO0O0 :#line:241
print ('------------------------------------')#line:242
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Sold!')#line:243
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Bitcoin Balance: '+O0O00000O00OO0OO0 +'%.8f'%getBalance ('BTC'))#line:244
OOOO0O0OOOOOOO00O =USD_BTC_Price ()#line:245
print (OOOO00OO0OOO0OOOO +OO00OO000O00O000O ('%H:%M:%S',O0000OO000OO0OOO0 ())+OO0OO0O0O0OOOOOO0 +O000OOO0OOOO0O0OO +'Bitcoin Balance in USD: '+O0O00000O00OO0OO0 +str (getBalance ('BTC')*OOOO0O0OOOOOOO00O ))#line:246
OO00O0O0O00O0O000 =False #line:247
def main ():#line:250
OOOOO0O0O00O0O000 =getBalance ('BTC')#line:251
OO00OOO0OOOO000O0 =USD_BTC_Price ()#line:252
O000OOOOO00000000 =float (OOOOO0O0O00O0O000 )*float (OO00OOO0OOOO000O0 )#line:253
print (O00OO00OOOOO0OO0O .Fore .RED +'_____________________________________________________________________')#line:254
print (O00OO00OOOOO0OO0O .Fore .RED +'Balance (BTC): '+str (OOOOO0O0O00O0O000 ))#line:255
print (O00OO00OOOOO0OO0O .Fore .RED +'Balance in USD: '+str (O000OOOOO00000000 ))#line:256
print (O00OO00OOOOO0OO0O .Fore .RED +'_____________________________________________________________________')#line:257
if OO000OOO00O0O0000 .system ()=="Windows":#line:258
OO0O000OOOOOO0O00 =input ('[1] Risk Multiplier: ')#line:259
OOO0OO000000O0OOO =input ('[2] % of bitcoin to spend: ')#line:260
OOO0OO0000OOO00OO =input ('[3] Profit %: ')#line:261
O00OO000OO0O0O0OO =input ('[4] Coin: ')#line:262
else :#line:263
OO0O000OOOOOO0O00 =input (O00OO00OOOOO0OO0O .Fore .CYAN +'[1] Risk Multiplier: ')#line:264
OOO0OO000000O0OOO =input (O00OO00OOOOO0OO0O .Fore .CYAN +'[2] % of bitcoin to spend: ')#line:265
OOO0OO0000OOO00OO =input (O00OO00OOOOO0OO0O .Fore .CYAN +'[3] Profit %: ')#line:266
O00OO000OO0O0O0OO =input (O00OO00OOOOO0OO0O .Fore .CYAN +'[4] Coin: ')#line:267
if len (OOO0OO0000OOO00OO )<=1 :#line:269
OOO0OO0000OOO00OO ='0.0'+OOO0OO0000OOO00OO #line:270
elif len (OOO0OO0000OOO00OO )<=2 :#line:271
OOO0OO0000OOO00OO ='0.'+OOO0OO0000OOO00OO #line:272
else :#line:273
if len (OOO0OO0000OOO00OO )<=3 :#line:274
OOO0OO0000OOO00OO =OOO0OO0000OOO00OO [0 ]+'.'+OOO0OO0000OOO00OO [1 :]#line:275
else :#line:276
OOO0OO0000OOO00OO =OOO0OO0000OOO00OO [0 :2 ]#line:277
if len (OOO0OO000000O0OOO )<=1 :#line:278
OOO0OO000000O0OOO ='0.0'+OOO0OO000000O0OOO #line:279
elif len (OOO0OO000000O0OOO )<=2 :#line:280
OOO0OO000000O0OOO ='0.'+OOO0OO000000O0OOO #line:281
else :#line:282
if len (OOO0OO000000O0OOO )<=3 :#line:283
OOO0OO000000O0OOO =OOO0OO000000O0OOO [0 ]+'.'+OOO0OO000000O0OOO [1 :]#line:284
else :#line:285
OOO0OO000000O0OOO =OOO0OO000000O0OOO [0 :2 ]#line:286
OO00OOO0000000O00 =float (OOOOO0O0O00O0O000 )*float (OOO0OO000000O0OOO )#line:288
Trade (O00OO000OO0O0O0OO .upper (),OOO0OO0000OOO00OO ,OO00OOO0000000O00 ,OO0O000OOOOOO0O00 )
#e9015584e6a44b14988f13e2298bcbf9