Extract resample_interval generation

This commit is contained in:
Matthias
2024-01-23 07:02:09 +01:00
parent 5167f6936d
commit c9c44a4710
4 changed files with 40 additions and 15 deletions

View File

@@ -8,9 +8,9 @@ from ccxt import (DECIMAL_PLACES, ROUND, ROUND_DOWN, ROUND_UP, SIGNIFICANT_DIGIT
from freqtrade.enums import RunMode
from freqtrade.exceptions import OperationalException
from freqtrade.exchange import (amount_to_contract_precision, amount_to_precision,
date_minus_candles, price_to_precision, timeframe_to_minutes,
timeframe_to_msecs, timeframe_to_next_date, timeframe_to_prev_date,
timeframe_to_seconds)
date_minus_candles, price_to_precision, timeframe_as_resample_freq,
timeframe_to_minutes, timeframe_to_msecs, timeframe_to_next_date,
timeframe_to_prev_date, timeframe_to_seconds)
from freqtrade.exchange.check_exchange import check_exchange
from tests.conftest import log_has_re
@@ -124,6 +124,20 @@ def test_timeframe_to_msecs():
assert timeframe_to_msecs("1d") == 86400000
@pytest.mark.parametrize("timeframe,expected", [
("1s", '1s'),
("15s", '15s'),
("5m", '300s'),
("10m", '600s'),
("1h", '3600s'),
("1d", '86400s'),
("1w", '604800s'),
("1M", '1MS'),
])
def test_timeframe_as_resample_freq(timeframe, expected):
assert timeframe_as_resample_freq(timeframe) == expected
def test_timeframe_to_prev_date():
# 2019-08-12 13:22:08
date = datetime.fromtimestamp(1565616128, tz=timezone.utc)