forked from verc/trustless-liquidity-pool
-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_client.py
executable file
·37 lines (34 loc) · 1.21 KB
/
run_client.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
import time
from python import client as nupool
import json
__author__ = 'woolly_sammoth'
config = json.load(open('pool.conf.json'))
clients = []
for conf in config:
client = nupool.Client(conf['server'])
if 'deviation' not in conf:
conf['deviation'] = 0.0025
if 'reset_timer' not in conf:
conf['reset_timer'] = 0
if 'offset' not in conf:
conf['offset'] = 0.002
if not client.set(conf['api_key'], conf['api_secret'], conf['address'],
conf['exchange'], conf['unit'], conf['bid_interest'],
conf['ask_interest'], conf['bot'], conf['order_match'],
conf['deviation'], conf['reset_timer'], conf['offset']):
print "Failed to start client for %s on %s using %s" % (conf['unit'],
conf['exchange'],
conf['api_key'])
client.start()
clients.append(client)
stop = False
while True:
try:
if stop:
for client in clients:
client.stop()
client.join()
break
time.sleep(60)
except KeyboardInterrupt:
stop = True