-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.py
53 lines (44 loc) · 1.22 KB
/
api.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
"""
Api Class which handles basic manipulation of objects
"""
import objects
import pools
class API():
"""
Wrapper Class for api access
"""
def __init__(self):
self.objects = objects.Objects()
def add_pools(self, filenames):
"""
Adds a set of pools
"""
for file_path in filenames:
pool = pools.Pool(file_path, self.objects )
self.objects.pools.add(pool)
def get_coins(self):
"""
Returns a set of cointypes
"""
return self.objects.coins
def get_pools(self):
"""
Returns a set of pools
"""
return self.objects.pools
def get_difficulty(self, coin_name):
"""
Returns the difficulty for the coin
"""
for coin in self.objects.coins:
if coin.name == coin_name:
return coin.difficulty
return None
def get_exchange(self, coin_name):
"""
Returns the difficulty for the coin
"""
for coin in self.objects.coins:
if coin.name == coin_name:
return coin.exchange
return None