Fix codestyle
This commit is contained in:
parent
82ea56c8fd
commit
2267a420a4
@ -122,7 +122,10 @@ def download_pairs(datadir, pairs: List[str],
|
|||||||
"""For each pairs passed in parameters, download the ticker intervals"""
|
"""For each pairs passed in parameters, download the ticker intervals"""
|
||||||
for pair in pairs:
|
for pair in pairs:
|
||||||
try:
|
try:
|
||||||
download_backtesting_testdata(datadir, pair=pair, interval=ticker_interval, timerange=timerange)
|
download_backtesting_testdata(datadir,
|
||||||
|
pair=pair,
|
||||||
|
interval=ticker_interval,
|
||||||
|
timerange=timerange)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
logger.info(
|
logger.info(
|
||||||
'Failed to download the pair: "%s", Interval: %s',
|
'Failed to download the pair: "%s", Interval: %s',
|
||||||
@ -139,7 +142,7 @@ def get_start_ts_from_timerange(timerange: Tuple[Tuple, int, int], interval: str
|
|||||||
|
|
||||||
if timerange[0][0] == 'date':
|
if timerange[0][0] == 'date':
|
||||||
return timerange[1] * 1000
|
return timerange[1] * 1000
|
||||||
|
|
||||||
if timerange[0][1] == 'line':
|
if timerange[0][1] == 'line':
|
||||||
num_minutes = timerange[2] * Constants.TICKER_INTERVAL_MINUTES[interval]
|
num_minutes = timerange[2] * Constants.TICKER_INTERVAL_MINUTES[interval]
|
||||||
return arrow.utcnow().shift(minutes=num_minutes).timestamp * 1000
|
return arrow.utcnow().shift(minutes=num_minutes).timestamp * 1000
|
||||||
@ -156,7 +159,7 @@ def download_backtesting_testdata(datadir: str,
|
|||||||
Download the latest ticker intervals from the exchange for the pairs passed in parameters
|
Download the latest ticker intervals from the exchange for the pairs passed in parameters
|
||||||
Based on @Rybolov work: https://github.com/rybolov/freqtrade-data
|
Based on @Rybolov work: https://github.com/rybolov/freqtrade-data
|
||||||
:param pairs: list of pairs to download
|
:param pairs: list of pairs to download
|
||||||
:param interval: ticker interval
|
:param interval: ticker interval
|
||||||
:param timerange: range of time to download
|
:param timerange: range of time to download
|
||||||
:return: bool
|
:return: bool
|
||||||
"""
|
"""
|
||||||
|
@ -167,7 +167,7 @@ def test_get_start_ts_from_timerange(mocker) -> None:
|
|||||||
|
|
||||||
start = get_start_ts_from_timerange(((None, 'line'), None, -200), '5m')
|
start = get_start_ts_from_timerange(((None, 'line'), None, -200), '5m')
|
||||||
assert start == (1367900664 - 5 * 200 * 60) * 1000
|
assert start == (1367900664 - 5 * 200 * 60) * 1000
|
||||||
|
|
||||||
|
|
||||||
def test_download_pairs_exception(ticker_history, mocker, caplog) -> None:
|
def test_download_pairs_exception(ticker_history, mocker, caplog) -> None:
|
||||||
mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history)
|
mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history)
|
||||||
|
@ -93,7 +93,8 @@ def test_parse_timerange_incorrect() -> None:
|
|||||||
|
|
||||||
assert (('date', None), 1274486400, None) == Arguments.parse_timerange('20100522-')
|
assert (('date', None), 1274486400, None) == Arguments.parse_timerange('20100522-')
|
||||||
assert ((None, 'date'), None, 1274486400) == Arguments.parse_timerange('-20100522')
|
assert ((None, 'date'), None, 1274486400) == Arguments.parse_timerange('-20100522')
|
||||||
assert (('date', 'date'), 1274486400, 1438214400) == Arguments.parse_timerange('20100522-20150730')
|
timerange = Arguments.parse_timerange('20100522-20150730')
|
||||||
|
assert timerange == (('date', 'date'), 1274486400, 1438214400)
|
||||||
|
|
||||||
with pytest.raises(Exception, match=r'Incorrect syntax.*'):
|
with pytest.raises(Exception, match=r'Incorrect syntax.*'):
|
||||||
Arguments.parse_timerange('-')
|
Arguments.parse_timerange('-')
|
||||||
|
@ -47,7 +47,7 @@ for pair in PAIRS:
|
|||||||
if not data:
|
if not data:
|
||||||
print('\tNo data was downloaded')
|
print('\tNo data was downloaded')
|
||||||
break
|
break
|
||||||
|
|
||||||
print('\tData was downloaded for period %s - %s' % (
|
print('\tData was downloaded for period %s - %s' % (
|
||||||
arrow.get(data[0][0] / 1000).format(),
|
arrow.get(data[0][0] / 1000).format(),
|
||||||
arrow.get(data[-1][0] / 1000).format()))
|
arrow.get(data[-1][0] / 1000).format()))
|
||||||
|
Loading…
Reference in New Issue
Block a user