From 3973d3697c7f964435af545bda25f2106988de2d Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 4 Oct 2018 20:35:28 +0200 Subject: [PATCH] deprecate ccxt_rate_limt --- docs/configuration.md | 2 +- freqtrade/configuration.py | 5 +++++ freqtrade/tests/test_configuration.py | 11 ++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 7c380e992..3512f891b 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -44,7 +44,7 @@ The table below will list all configuration parameters. | `exchange.secret` | secret | No | API secret to use for the exchange. Only required when you are in production mode. | `exchange.pair_whitelist` | [] | No | List of currency to use by the bot. Can be overrided with `--dynamic-whitelist` param. | `exchange.pair_blacklist` | [] | No | List of currency the bot must avoid. Useful when using `--dynamic-whitelist` param. -| `exchange.ccxt_rate_limit` | True | No | Have CCXT handle Exchange rate limits. Depending on the exchange, having this to false can lead to temporary bans from the exchange. +| `exchange.ccxt_rate_limit` | True | No | DEPRECATED!! Have CCXT handle Exchange rate limits. Depending on the exchange, having this to false can lead to temporary bans from the exchange. | `exchange.ccxt_config` | None | No | Additional CCXT parameters passed to the regular ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation) | `exchange.ccxt_async_config` | None | No | Additional CCXT parameters passed to the async ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation) | `experimental.use_sell_signal` | false | No | Use your sell strategy in addition of the `minimal_roi`. diff --git a/freqtrade/configuration.py b/freqtrade/configuration.py index 4e1137f33..93ae3deab 100644 --- a/freqtrade/configuration.py +++ b/freqtrade/configuration.py @@ -271,6 +271,11 @@ class Configuration(object): raise OperationalException( exception_msg ) + # Depreciation warning + if 'ccxt_rate_limit' in config.get('exchange', {}): + logger.warning("`ccxt_rate_limit` has been deprecated in favor of " + "`ccxt_config` and `ccxt_async_config` and will be removed " + "in future a future version.") logger.debug('Exchange "%s" supported', exchange) return True diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index bf41aab83..2c487c165 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -371,7 +371,7 @@ def test_hyperopt_with_arguments(mocker, default_conf, caplog) -> None: assert log_has('Parameter -s/--spaces detected: [\'all\']', caplog.record_tuples) -def test_check_exchange(default_conf) -> None: +def test_check_exchange(default_conf, caplog) -> None: configuration = Configuration(Namespace()) # Test a valid exchange @@ -392,6 +392,15 @@ def test_check_exchange(default_conf) -> None: ): configuration.check_exchange(default_conf) + # Test ccxt_rate_limit depreciation + default_conf.get('exchange').update({'name': 'binance'}) + default_conf['exchange']['ccxt_rate_limit'] = True + configuration.check_exchange(default_conf) + assert log_has("`ccxt_rate_limit` has been deprecated in favor of " + "`ccxt_config` and `ccxt_async_config` and will be removed " + "in future a future version.", + caplog.record_tuples) + def test_cli_verbose_with_params(default_conf, mocker, caplog) -> None: mocker.patch('freqtrade.configuration.open', mocker.mock_open(