-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathutility.py
55 lines (49 loc) · 1.65 KB
/
utility.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
from exchangeAPI.poloniex import Poloniex
from exchangeAPI.bitmex import Bitmex
from exchangeAPI.bitfinex import Bitfinex
from exchangeAPI.bittrex import Bittrex
from exchangeAPI.gdax import Gdax
template = {
'poloniex' : [],
'bittrex' : [],
'gdax' : [],
'bitfinex' : [],
'bitmex' : []
}
template2 = {
'poloniex' : Poloniex,
'bittrex' : Bittrex,
'gdax' : Gdax,
'bitfinex' : Bitfinex,
'bitmex' : Bitmex
}
def check_exchanges(list_):
error = False
for exch in list_:
if exch not in template.keys():
print ('There is no exchange named: ' + exch)
error = True
if error:
print ('Invalid command. Please, try again.')
return True
return False
def check_cur_pair(pair, exchanges):
error = False
for exch in exchanges:
res = template2[exch].check_pair(pair)
if res[0] == False:
error = True
print (exch + ': ' + res[1])
return error
def wtf():
er_text = '.\n.\n.'
print (er_text)
help_message = ('Available commands:\n'
' /add CUR1_CUR2 exchg1 exchg2 ... exchg5 - add instrument for collecting on given exchanges'
' if it is available there. Can be used with bot turned on.\n'
' /remove CUR1_CUR2 exchg1 exchg2 ... exchg5 - remove instrument from collecting on given'
' exchanges.\n'
' /info - show information about current bot settings (what instruments are being collected'
' at the moment).\n'
' /on - turn the bot on and start collecting.\n'
' /off - turn the bot off and stop collecting.')