Example #1
0
 def keepconnect(self, *args, **kwargs):
     """保持连接器"""
     while True:
         if not self.status:
             self.__connect()
             print('正在连接...')
             self.threadDict['connect'] = myThread(
                 target=self.ws.run_forever, args=args, kwargs=kwargs)
             self.threadDict['connect'].start()
             self.refreshSend = 1
             sleep(10)
@author: JERRY
"""

import pymysql as ps
from sqlalchemy import create_engine
from datapool.E_huobi.E_huobi_ws.E_huobi_api import HuobiApi
from utilPool.generalUtil import myThread

ps.install_as_MySQLdb()

proxy = {'http_proxy_host': '101.201.79.172', 'http_proxy_port': '808'}

tableName = 'huobi'
conn = create_engine(
    'mysql://*****:*****@localhost/datapool?charset=utf8', echo=False)

threadList = []
test = HuobiApi()
param = {'depth': {'sub': 'market.btcusdt.depth.step5', 'id': 'id1'}}

threadList.append(myThread(name='monitor', target=test.isDisconn))
threadList.append(
    myThread(name='keepConnect', target=test.keepconnect, kwargs=proxy))
threadList.append(
    myThread(name='refreshCommand', target=test.refreshCommand,
             args=(param, )))
threadList.append(
    myThread(name='saveData', target=test.saveData, args=(conn, tableName)))
for i in threadList:
    i.start()
Example #3
0
from datapool.E_livecoin.E_livecoin_rest.E_livecoin_api import LiveCoin
import pymysql as ps
from sqlalchemy import create_engine
from utilPool.generalUtil import myThread
import urllib
from collections import OrderedDict

ps.install_as_MySQLdb()

proxy = {'http_proxy_host': '119.27.177.169', 'http_proxy_port': '80'}

tableName = 'livecoin'
conn = create_engine(
    'mysql://*****:*****@[email protected]/zzmf_trading?charset=utf8',
    echo=False)

threadList = []
test = LiveCoin(proxy)
data = OrderedDict([('currencyPair', 'BTC/EUR')])
param = urllib.parse.urlencode(data)

threadList.append(
    myThread(name='depth', target=test.callback, args=(test.orderBook, param)))
threadList.append(
    myThread(name='saveData', target=test.saveData, args=(conn, tableName)))

for i in threadList:
    i.start()
# -*- coding: utf-8 -*-
"""
Created on 2018/1/14 18:14

@author: JERRY
"""

from datapool.E_bit_z.E_bit_z_rest.E_bit_z_api import BitZ
import pymysql as ps
from sqlalchemy import create_engine
from utilPool.generalUtil import myThread

ps.install_as_MySQLdb()

proxy = {'http_proxy_host': '119.27.177.169', 'http_proxy_port': '80'}

tableName = 'bit_z'
conn = create_engine(
    'mysql://*****:*****@[email protected]/zzmf_trading?charset=utf8',
    echo=False)

threadList = []
test = BitZ(proxy)
param = 'btc_usdt'

threadList.append(
    myThread(name='depth', target=test.callback, args=(test.orderBook, param)))

for i in threadList:
    i.start()
Example #5
0
ps.install_as_MySQLdb()

proxy = {'host': '127.0.0.1',
         'port': 1080}

tableName = 'bitfinex_rest'
conn = create_engine('mysql://*****:*****@[email protected]/zzmf_trading?charset=utf8', echo=False)

threadList = []
test = BitfinexRest(proxy)

# 测试币种
param = 'btcusd'

threadList.append(myThread(name='getOrderBook', target=test.callback, args=(test.getOrderBook, param)))
threadList.append(myThread(name='saveData', target=test.saveData, args=(conn, tableName)))

for i in threadList:
    i.start()

# import pymysql as ps
# from sqlalchemy import create_engine
# from datapool.E_bitfinex.E_bitfinex_ws.E_bitfinex_api import BitfinexWs
# from utilPool.generalUtil import myThread
#
# ps.install_as_MySQLdb()
#
# proxy = {'http_proxy_host': '118.114.77.47',
#          'http_proxy_port': '8080'}
#