Add some safety measures for new startup_candles verification

This commit is contained in:
Matthias 2022-05-15 15:12:29 +02:00
parent d60d0f64d2
commit 9143e9ecb1
3 changed files with 4 additions and 2 deletions

View File

@ -622,7 +622,8 @@ class Exchange:
candle_limit = self.ohlcv_candle_limit(
timeframe, self._config['candle_type_def'],
date_minus_candles(timeframe, startup_candles))
int(date_minus_candles(timeframe, startup_candles).timestamp() * 1000)
if timeframe else None)
# Require one more candle - to account for the still open candle.
candle_count = startup_candles + 1
# Allow 5 calls to the exchange per pair

View File

@ -1,5 +1,4 @@
import logging
from datetime import datetime, timedelta, timezone
from typing import Dict, List, Optional, Tuple
import ccxt

View File

@ -939,6 +939,7 @@ def test_validate_timeframes_emulated_ohlcvi_2(default_conf, mocker):
def test_validate_timeframes_not_in_config(default_conf, mocker):
# TODO: this test does not assert ...
del default_conf["timeframe"]
api_mock = MagicMock()
id_mock = PropertyMock(return_value='test_exchange')
@ -954,6 +955,7 @@ def test_validate_timeframes_not_in_config(default_conf, mocker):
mocker.patch('freqtrade.exchange.Exchange.validate_pairs')
mocker.patch('freqtrade.exchange.Exchange.validate_stakecurrency')
mocker.patch('freqtrade.exchange.Exchange.validate_pricing')
mocker.patch('freqtrade.exchange.Exchange.validate_required_startup_candles')
Exchange(default_conf)