From 632c1bc0aa8eec3953318b2d50efe6d2dc632f57 Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Mon, 14 Jun 2021 14:39:12 +0900 Subject: [PATCH] Add static workaround for kucoin 429000 issue closes #5700 --- freqtrade/exchange/common.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/freqtrade/exchange/common.py b/freqtrade/exchange/common.py index 644a13e93..a4c827e07 100644 --- a/freqtrade/exchange/common.py +++ b/freqtrade/exchange/common.py @@ -81,9 +81,16 @@ def retrier_async(f): count -= 1 kwargs.update({'count': count}) if isinstance(ex, DDosProtection): - backoff_delay = calculate_backoff(count + 1, API_RETRY_COUNT) - logger.info(f"Applying DDosProtection backoff delay: {backoff_delay}") - await asyncio.sleep(backoff_delay) + if "kucoin" in str(ex) and "429000" in str(ex): + # Temporary fix for 429000 error on kucoin + # see https://github.com/freqtrade/freqtrade/issues/5700 for details. + logger.warning( + f"Kucoin 429 error, avoid triggering DDosProtection backoff delay. " + f"{count} tries left before giving up") + else: + backoff_delay = calculate_backoff(count + 1, API_RETRY_COUNT) + logger.info(f"Applying DDosProtection backoff delay: {backoff_delay}") + await asyncio.sleep(backoff_delay) return await wrapper(*args, **kwargs) else: logger.warning('Giving up retrying: %s()', f.__name__)