Ejemplo n.º 1
0
 def __init__(self):
     self.k = ct.kraken()
     self.y = ct.yobit()
     self.p = ct.poloniex()
     self.coinmarket = ct.coinmarketcap()
     self.liqui = ct.bitfinex()
     print(ct.exchanges)
     print(self.k.hasFetchOHLCV, self.k.rateLimit)
     print(self.y.hasFetchOHLCV, self.y.rateLimit)
     print(self.p.hasFetchOHLCV, self.p.rateLimit)
     # print(self.coinmarket.hasFetchOHLCV, self.coinmarket.rateLimit)
     keys_conf = conf.TradeKeys()
     #print(keys_conf.keys_info)
     self.k.apiKey = keys_conf.keys_info['kraken']['public']
     self.k.secret = keys_conf.keys_info['kraken']['secret']
     #self.k.load_markets()
     print(self.k.symbols)
Ejemplo n.º 2
0
    def __init__(self, x = 0, y = 16, width = 80, height = 15, is_view = True):
        #cv.console_view.__init__(self, x, y, width, height, is_view)
        self.is_stop = False
        self.num = 50
        self.pos_y = 2
        self.target_symbol = ['ltcusdt']
        #self.coin_url = "https://api.coinmarketcap.com/v1/ticker/?limit=%d"%self.num
        self.base_url_inner = 'https://api.huobipro.com'
        self.base_url_outer = 'https://api.huobi.pro'
        #self.base_url = self.base_url_inner
        self.base_url = self.base_url_outer
        self.trade_base_url ='https://poloniex.com/tradingApi'
        self.order_book_url = 'https://poloniex.com/public?command=returnOrderBook&&currencyPair=all&depth=1'
        self.send_headers = {
'Content-Type':'application/x-www-form-urlencoded',
 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36',
 'Cookie':'__cfduid=d92eb21c1dd0e150a8e730ef1e8780fd61516264900; cf_clearance=e61fba35a2c2bdc9cd35af99cb5ca9112244f353-1516613184-1800'
} 
        keys_conf = conf.TradeKeys()
        self.cur_balances = {}
        self.apikey = keys_conf.keys_info['huobi']['public']
        self.secret = keys_conf.keys_info['huobi']['secret']
        ##self.apikey = 'aaa'
        #self.secret = 'bbb'
        #self.display_pos = {'x':0, 'y':16, 'width':80, 'height':15}
	#print(self.secret)
	#print(self.apikey)
        self.monitor_info = {
                'time':time.time(),
                'BTC':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}, 'change':-1, 'isFrozen':-1},
                'LTC':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}, 'change':-1, 'isFrozen':-1},
                'ETH':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}, 'change':-1, 'isFrozen':-1},
                'XRP':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}, 'change':-1, 'isFrozen':-1},
                'DASH':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}, 'change':-1,'isFrozen':-1},
                'DOGE':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}, 'change':-1,'isFrozen':-1}
            }
        self.symbol_info_pair = {'btcusdt':'BTC','ltcusdt':'LTC','USDT_ETH':'ETH','USDT_XRP':'XRP', 'BTC_DOGE':'DOGE', 'USDT_DASH':'DASH'}
        self.trade_info_pair = {'btcusdt':'btc','ltcusdt':'ltc','xrpusdt':'xrp'}

        self.trade_info_pair_inv = {}
        for key,val in self.trade_info_pair.items():
            self.trade_info_pair_inv[val] = key
Ejemplo n.º 3
0
    def __init__(self, x = 80, y = 16, width = 80, height = 15, is_view = True):
        #cv.console_view.__init__(self, x, y, width, height, is_view)
        self.is_stop = False
        self.num = 50
        self.pos_y = 2
        self.target_symbol = ('BTC','ETH','XRP', 'BCH', 'LTC',  'DASH', 'USDT', 'DOGE')
        self.method = ('depth','ticker','trades', 'info')
        self.trade_list = ('XXBTZUSD', 'XLTCZUSD', 'BCHUSD', 'XETHZUSD', 'XXRPZUSD','DASHUSD') 
        #self.coin_url = "https://api.coinmarketcap.com/v1/ticker/?limit=%d"%self.num
        self.base_url = 'https://api.kraken.com/0/public/Ticker?pair='
        self.order_book_url = 'https://api.kraken.com/0/public/Depth?count=1&pair='
        self.api_url = 'https://api.kraken.com'
        self.api_version = '0'
        self.send_headers = {
 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
 'Connection':'keep-alive'
} 
        self.monitor_info = {
                'time':time.time(),
                'BTC':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}},
                'LTC':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}},
                'ETH':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}},
                'XRP':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}},
                'DASH':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}},
                'DOGE':{'last':{'price':-1, 'num':-1}, 'bid':{'price':-1, 'num':-1}, 'ask':{'price':-1, 'num':-1}}
            }
        self.symbol_info_pair = {'XXBTZUSD':'BTC','XLTCZUSD':'LTC','XETHZUSD':'ETH','XXRPZUSD':'XRP', 'DASHUSD':'DASH'}
        self.symbol_info_pair_inv = {}
        for key,val in self.symbol_info_pair.items():
            self.symbol_info_pair_inv[val] = key   

        keys_conf = conf.TradeKeys()
        self.cur_balances = {}
        self.apikey = keys_conf.keys_info['kraken']['public']
        self.secret = keys_conf.keys_info['kraken']['secret']
Ejemplo n.º 4
0
 def __init__(self, x=0, y=16, width=80, height=15, is_view=True):
     #cv.console_view.__init__(self, x, y, width, height, is_view)
     self.is_stop = False
     self.num = 50
     self.pos_y = 2
     self.fee_rate = 0.0025
     self.target_symbol = ('USDT_BTC', 'USDT_LTC', 'USDT_BCH', 'USDT_ETH',
                           'USDT_XRP', 'USDT_DASH', 'BTC_DOGE')
     self.method = ('depth', 'ticker', 'trades', 'info')
     self.trade_list = ('ltc_usd', 'btc_usd', 'eth_usd', 'bcc_usd',
                        'dash_usd', 'doge_usd')
     #self.coin_url = "https://api.coinmarketcap.com/v1/ticker/?limit=%d"%self.num
     self.base_url = 'https://poloniex.com/public?command=returnTicker'
     self.trade_base_url = 'https://poloniex.com/tradingApi'
     self.order_book_url = 'https://poloniex.com/public?command=returnOrderBook&&currencyPair=all&depth=1'
     self.send_headers = {
         'Accept':
         'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
         'User-Agent':
         'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0',
         'Cookie':
         '__cfduid=d92eb21c1dd0e150a8e730ef1e8780fd61516264900; cf_clearance=e61fba35a2c2bdc9cd35af99cb5ca9112244f353-1516613184-1800'
     }
     keys_conf = conf.TradeKeys()
     self.cur_balances = {}
     self.apikey = keys_conf.keys_info['poloniex']['public']
     self.secret = keys_conf.keys_info['poloniex']['secret']
     ##self.apikey = 'aaa'
     #self.secret = 'bbb'
     #self.display_pos = {'x':0, 'y':16, 'width':80, 'height':15}
     #print(self.secret)
     #print(self.apikey)
     self.monitor_info = {
         'time': time.time(),
         'BTC': {
             'last': {
                 'price': -1,
                 'num': -1
             },
             'bid': {
                 'price': -1,
                 'num': -1
             },
             'ask': {
                 'price': -1,
                 'num': -1
             },
             'change': -1,
             'isFrozen': -1
         },
         'LTC': {
             'last': {
                 'price': -1,
                 'num': -1
             },
             'bid': {
                 'price': -1,
                 'num': -1
             },
             'ask': {
                 'price': -1,
                 'num': -1
             },
             'change': -1,
             'isFrozen': -1
         },
         'ETH': {
             'last': {
                 'price': -1,
                 'num': -1
             },
             'bid': {
                 'price': -1,
                 'num': -1
             },
             'ask': {
                 'price': -1,
                 'num': -1
             },
             'change': -1,
             'isFrozen': -1
         },
         'XRP': {
             'last': {
                 'price': -1,
                 'num': -1
             },
             'bid': {
                 'price': -1,
                 'num': -1
             },
             'ask': {
                 'price': -1,
                 'num': -1
             },
             'change': -1,
             'isFrozen': -1
         },
         'DASH': {
             'last': {
                 'price': -1,
                 'num': -1
             },
             'bid': {
                 'price': -1,
                 'num': -1
             },
             'ask': {
                 'price': -1,
                 'num': -1
             },
             'change': -1,
             'isFrozen': -1
         },
         'DOGE': {
             'last': {
                 'price': -1,
                 'num': -1
             },
             'bid': {
                 'price': -1,
                 'num': -1
             },
             'ask': {
                 'price': -1,
                 'num': -1
             },
             'change': -1,
             'isFrozen': -1
         }
     }
     self.symbol_info_pair = {
         'USDT_BTC': 'BTC',
         'USDT_LTC': 'LTC',
         'USDT_ETH': 'ETH',
         'USDT_XRP': 'XRP',
         'BTC_DOGE': 'DOGE',
         'USDT_DASH': 'DASH'
     }
     self.symbol_info_pair_inv = {}
     for key, val in self.symbol_info_pair.items():
         self.symbol_info_pair_inv[val] = key