forked from wookpump/wookpump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exchange.py
38 lines (26 loc) · 903 Bytes
/
exchange.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
from bittrex import Bittrex
from yobit import Yobit
import json
"""
Example:
from exchange import Exchange
myExchange = Exchange('yobit').getExchange()
markets = myExchange.get_markets()
"""
class Exchange:
'Super Class'
def __init__(self, exchange_name):
self.exchange = exchange_name
def getExchange(self):
if self.exchange == 'bittrex':
with open("secrets.json") as secrets_file:
secrets = json.load(secrets_file)
secrets_file.close()
bittrex = Bittrex(secrets['key'], secrets['secret'])
return bittrex
elif self.exchange == 'yobit':
with open("secrets_yobit.json") as secrets_file:
secrets = json.load(secrets_file)
secrets_file.close()
yobit = Yobit(secrets['key'], secrets['secret'])
return yobit