mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-02 01:53:05 +00:00
Extract resample_interval generation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user