async def setUpClass(cls):
     cls.aws = HuobiAsyncWs(test_apikey, test_secret)
     cls.huobi = ccxt.huobipro({
         "apiKey": test_apikey,
         "secret": test_secret,
         "enableRateLimit": True,
     })
Esempio n. 2
0
def get_async_client(exchange_id: "exchange id"):
    assert (config.SUPPORT_EXCHANGE)

    if exchange_id == "binance":
        return ccxt.binance({'enableRateLimit': True})
    elif exchange_id == "bitfinex2":
        return ccxt.bitfinex2({'enableRateLimit': True})
    elif exchange_id == "coinbasepro":
        return ccxt.coinbasepro({'enableRateLimit': True})
    elif exchange_id == "huobipro":
        return ccxt.huobipro({'enableRateLimit': True})
    elif exchange_id == "okex":
        return ccxt.okex({'enableRateLimit': True})

    return None
Esempio n. 3
0
     'enableRateLimit':
     True,  # this option enables the built-in rate limiter
 }),
 "coinbasepro":
 ccxt.coinbasepro({
     'enableRateLimit':
     True,  # this option enables the built-in rate limiter
 }),
 "bitfinex2":
 ccxt.bitfinex2({
     'enableRateLimit':
     True,  # this option enables the built-in rate limiter
 }),
 "huobipro":
 ccxt.huobipro({
     'enableRateLimit':
     True,  # this option enables the built-in rate limiter
 }),
 "okex":
 ccxt.okex({
     'enableRateLimit':
     True,  # this option enables the built-in rate limiter
 }),
 "kraken":
 ccxt.kraken({
     'enableRateLimit':
     True,  # this option enables the built-in rate limiter
 }),
 "bitmex":
 ccxt.bitmex({
     'enableRateLimit':
     True,  # this option enables the built-in rate limiter
Esempio n. 4
0
    def __init__(self, loop, config):

        self.ob_constant = OD_TICK_TIMER
        self.bl_constant = BALANCE_TICK_TIMER
        self.trade_constant = TRADE_TICK_TIMER

        self.stop_tick_time = datetime.datetime.now() + datetime.timedelta(
            seconds=TICK_TIMER)
        self.orderbook_tick_time = datetime.datetime.now(
        ) + datetime.timedelta(seconds=self.ob_constant)
        self.balance_tick_time = datetime.datetime.now() + datetime.timedelta(
            seconds=self.bl_constant)
        self.trade_tick_time = datetime.datetime.now() + datetime.timedelta(
            seconds=self.trade_constant)
        self.info_tick_time = datetime.datetime.now() + datetime.timedelta(
            seconds=INFO_TIMER)

        self.config = config
        self.orderbook_count = 0
        self.pair_info = dict()
        self.logger = None
        if 'logger' in self.config.keys():
            self.logger = self.config['logger']

        self.exhange = config['exchange']
        self.is_auth = False
        self.name = '[ccxt %s]' % self.exhange
        self.pair_list = set()

        if self.exhange == 'liqui':
            self.ob_constant = 30
            self.bl_constant = 60

        self.ccxt_it_queue = self.config['ccxt_in_queue']
        self.ccxt_out_queue = self.config['ccxt_out_queue']

        self.pair_list = self.config['pairs']

        # for i in self.config['pairs']:
        #     i['balance_tick'] = True
        #     self.pair_list.add( i['name'] )

        auth = {}
        if 'auth' in self.config.keys():
            auth = self.config['auth']
            self.is_auth = True
            self.name = '[ccxt %s %s*]' % (self.exhange, auth['apiKey'][:4])

        asyncio.set_event_loop(loop)

        if self.exhange == 'hitbtc':
            loop.create_task(self.run_loop(ccxt.hitbtc(auth)))
        elif self.exhange == 'coinmarketcap':
            loop.create_task(self.run_loop(ccxt.coinmarketcap()))
        elif self.exhange == 'binance':
            loop.create_task(self.run_loop(ccxt.binance(auth)))
        elif self.exhange == 'bitmex':
            loop.create_task(self.run_loop(ccxt.bitmex(auth)))
        elif self.exhange == 'huobipro':
            loop.create_task(self.run_loop(ccxt.huobipro()))
        elif self.exhange == 'liqui':
            loop.create_task(self.run_loop(ccxt.liqui(auth)))
        elif self.exhange == 'bitfinex2':
            loop.create_task(self.run_loop(ccxt.bitfinex2(auth)))
        elif self.exhange == 'bitfinex':
            loop.create_task(self.run_loop(ccxt.bitfinex(auth)))
        elif self.exhange == 'okex':
            loop.create_task(self.run_loop(ccxt.okex(auth)))
        elif self.exhange == 'kucoin':
            loop.create_task(self.run_loop(ccxt.kucoin(auth)))
        elif self.exhange == 'bittrex':
            loop.create_task(self.run_loop(ccxt.bittrex(auth)))
        elif self.exhange == 'qryptos':
            loop.create_task(self.run_loop(ccxt.qryptos(auth)))
        elif self.exhange == 'kraken':
            loop.create_task(self.run_loop(ccxt.kraken(auth)))

        loop.run_forever()