mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
Fix yearly resample timeframe
This commit is contained in:
@@ -124,6 +124,8 @@ def timeframe_to_resample_freq(timeframe: str) -> str:
|
||||
form ('1m', '5m', '1h', '1d', '1w', etc.) to the resample frequency
|
||||
used by pandas ('1T', '5T', '1H', '1D', '1W', etc.)
|
||||
"""
|
||||
if timeframe == '1y':
|
||||
return '1YS'
|
||||
timeframe_seconds = timeframe_to_seconds(timeframe)
|
||||
timeframe_minutes = timeframe_seconds // 60
|
||||
resample_interval = f'{timeframe_seconds}s'
|
||||
|
||||
@@ -133,6 +133,7 @@ def test_timeframe_to_msecs():
|
||||
("1d", '86400s'),
|
||||
("1w", '604800s'),
|
||||
("1M", '1MS'),
|
||||
("1y", '1YS'),
|
||||
])
|
||||
def test_timeframe_to_resample_freq(timeframe, expected):
|
||||
assert timeframe_to_resample_freq(timeframe) == expected
|
||||
|
||||
Reference in New Issue
Block a user