From db39b6ca7eebbfcdbb3e9575fdabced3de072e28 Mon Sep 17 00:00:00 2001 From: Samuel Holt Date: Mon, 23 Oct 2017 21:11:49 +0800 Subject: [PATCH] Implemented fixes for issues raised on Pull Request #373, proper exponential backoff random selection times (in seconds) and lowering Krakens starting tokens, to avoid being rate limited on Kraken --- ccxt/async/exchange.py | 2 +- ccxt/async/exchanges.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ccxt/async/exchange.py b/ccxt/async/exchange.py index 3814bfc8d2d3..36184fe7c1d8 100644 --- a/ccxt/async/exchange.py +++ b/ccxt/async/exchange.py @@ -81,7 +81,7 @@ async def wait_for_token(self): # if self.verbose: # print('Waiting for tokens: Exchange: {0}'.format(self.id)) self.add_new_tokens() - seconds_delays = [0.01, 0.1, 0.7, 1, 1.5, 2] + seconds_delays = [0.001, 0.005, 0.022, 0.106, 0.5] delay = random.choice(seconds_delays) await asyncio.sleep(delay) self.rateLimitTokens -= 1 diff --git a/ccxt/async/exchanges.py b/ccxt/async/exchanges.py index 5f4db52bf09b..d6848a959cf5 100644 --- a/ccxt/async/exchanges.py +++ b/ccxt/async/exchanges.py @@ -14675,6 +14675,8 @@ def __init__(self, config={}): 'hasFetchClosedOrders': True, 'hasFetchMyTrades': True, 'hasWithdraw': True, + 'rateLimitTokens': 8, + 'rateLimitMaxTokens': 8, 'marketsByAltname': {}, 'timeframes': { '1m': '1',