mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-27 18:42:13 +08:00
Fix H candle support
This commit is contained in:
@@ -190,6 +190,9 @@ class CCXT(Exchange):
|
||||
if data_frequency == 'minute' and not freq.endswith('T'):
|
||||
continue
|
||||
|
||||
elif data_frequency == 'hourly' and not freq.endswith('D'):
|
||||
continue
|
||||
|
||||
elif data_frequency == 'daily' and not freq.endswith('D'):
|
||||
continue
|
||||
|
||||
|
||||
@@ -509,10 +509,6 @@ class Exchange:
|
||||
frequency, data_frequency, supported_freqs=['T', 'D', 'H']
|
||||
)
|
||||
|
||||
if unit == 'H':
|
||||
raise InvalidHistoryFrequencyAlias(
|
||||
freq=frequency)
|
||||
|
||||
# we want to avoid receiving empty candles
|
||||
# so we request more than needed
|
||||
# TODO: consider defining a const per asset
|
||||
|
||||
@@ -249,7 +249,7 @@ def get_year_start_end(dt, first_day=None, last_day=None):
|
||||
return year_start, year_end
|
||||
|
||||
|
||||
def get_frequency(freq, data_frequency=None, supported_freqs=['D', 'T']):
|
||||
def get_frequency(freq, data_frequency=None, supported_freqs=['D', 'H', 'T']):
|
||||
"""
|
||||
Get the frequency parameters.
|
||||
|
||||
@@ -309,6 +309,7 @@ def get_frequency(freq, data_frequency=None, supported_freqs=['D', 'T']):
|
||||
if 'H' in supported_freqs:
|
||||
unit = 'H'
|
||||
alias = '{}H'.format(candle_size)
|
||||
data_frequency = 'hourly'
|
||||
|
||||
else:
|
||||
candle_size = candle_size * 60
|
||||
|
||||
Reference in New Issue
Block a user