From de4bc7204d99c77afd19c446bc0811181911e616 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 7 Nov 2021 13:14:29 +0100 Subject: [PATCH] Update documentation to clarify new behaviour --- docs/strategy-customization.md | 9 +++++++-- freqtrade/exchange/exchange.py | 2 +- tests/exchange/test_exchange.py | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/strategy-customization.md b/docs/strategy-customization.md index 62e7509b3..d445234b5 100644 --- a/docs/strategy-customization.md +++ b/docs/strategy-customization.md @@ -134,7 +134,7 @@ Additional technical libraries can be installed as necessary, or custom indicato ### Strategy startup period -Most indicators have an instable startup period, in which they are either not available, or the calculation is incorrect. This can lead to inconsistencies, since Freqtrade does not know how long this instable period should be. +Most indicators have an instable startup period, in which they are either not available (NaN), or the calculation is incorrect. This can lead to inconsistencies, since Freqtrade does not know how long this instable period should be. To account for this, the strategy can be assigned the `startup_candle_count` attribute. This should be set to the maximum number of candles that the strategy requires to calculate stable indicators. @@ -146,8 +146,13 @@ In this example strategy, this should be set to 100 (`startup_candle_count = 100 By letting the bot know how much history is needed, backtest trades can start at the specified timerange during backtesting and hyperopt. +!!! Warning "Using x calls to get OHLCV" + If you receive a warning like `WARNING - Using 3 calls to get OHLCV. This can result in slower operations for the bot. Please check if you really need 1500 candles for your strategy` - you should consider if you really need this much lookback. + This will make Freqtrade take longer to refresh candles - and should be avoided if possible. + This is capped to 5 total calls to avoid overloading the exchange, or make freqtrade too slow. + !!! Warning - `startup_candle_count` should be below `ohlcv_candle_limit` (which is 500 for most exchanges) - since only this amount of candles will be available during Dry-Run/Live Trade operations. + `startup_candle_count` should be below `ohlcv_candle_limit * 5` (which is 500 * 5 for most exchanges) - since only this amount of candles will be available during Dry-Run/Live Trade operations. #### Example diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 4e9a6c71d..19ad4e4b6 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -471,7 +471,7 @@ class Exchange: raise OperationalException( f'Time in force policies are not supported for {self.name} yet.') - def validate_required_startup_candles(self, startup_candles: int, timeframe: str) -> None: + def validate_required_startup_candles(self, startup_candles: int, timeframe: str) -> int: """ Checks if required startup_candles is more than ohlcv_candle_limit(). Requires a grace-period of 5 candles - so a startup-period up to 494 is allowed by default. diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index ff78321c5..8a8569dc4 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -960,7 +960,6 @@ def test_validate_required_startup_candles(default_conf, mocker, caplog): Exchange(default_conf) - def test_exchange_has(default_conf, mocker): exchange = get_patched_exchange(mocker, default_conf) assert not exchange.exchange_has('ASDFASDF')