Switch load_data to kwargs
This commit is contained in:
parent
acd07d40a0
commit
429f846ad1
@ -100,7 +100,7 @@ class Edge():
|
|||||||
logger.info('Using local backtesting data (using whitelist in given config) ...')
|
logger.info('Using local backtesting data (using whitelist in given config) ...')
|
||||||
|
|
||||||
data = history.load_data(
|
data = history.load_data(
|
||||||
Path(self.config['datadir']) if self.config.get('datadir') else None,
|
datadir=Path(self.config['datadir']) if self.config.get('datadir') else None,
|
||||||
pairs=pairs,
|
pairs=pairs,
|
||||||
ticker_interval=self.ticker_interval,
|
ticker_interval=self.ticker_interval,
|
||||||
refresh_pairs=self._refresh_pairs,
|
refresh_pairs=self._refresh_pairs,
|
||||||
|
@ -370,7 +370,7 @@ class Backtesting(object):
|
|||||||
timerange = Arguments.parse_timerange(None if self.config.get(
|
timerange = Arguments.parse_timerange(None if self.config.get(
|
||||||
'timerange') is None else str(self.config.get('timerange')))
|
'timerange') is None else str(self.config.get('timerange')))
|
||||||
data = history.load_data(
|
data = history.load_data(
|
||||||
Path(self.config['datadir']) if self.config.get('datadir') else None,
|
datadir=Path(self.config['datadir']) if self.config.get('datadir') else None,
|
||||||
pairs=pairs,
|
pairs=pairs,
|
||||||
ticker_interval=self.ticker_interval,
|
ticker_interval=self.ticker_interval,
|
||||||
refresh_pairs=self.config.get('refresh_pairs', False),
|
refresh_pairs=self.config.get('refresh_pairs', False),
|
||||||
|
@ -58,7 +58,7 @@ def test_load_data_30min_ticker(ticker_history, mocker, caplog, default_conf) ->
|
|||||||
mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history)
|
mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history)
|
||||||
file = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'UNITTEST_BTC-30m.json')
|
file = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'UNITTEST_BTC-30m.json')
|
||||||
_backup_file(file, copy_file=True)
|
_backup_file(file, copy_file=True)
|
||||||
ld = history.load_data(None, pairs=['UNITTEST/BTC'], ticker_interval='30m')
|
ld = history.load_data(datadir=None, pairs=['UNITTEST/BTC'], ticker_interval='30m')
|
||||||
assert isinstance(ld, dict)
|
assert isinstance(ld, dict)
|
||||||
assert os.path.isfile(file) is True
|
assert os.path.isfile(file) is True
|
||||||
assert not log_has('Download the pair: "UNITTEST/BTC", Interval: 30m', caplog.record_tuples)
|
assert not log_has('Download the pair: "UNITTEST/BTC", Interval: 30m', caplog.record_tuples)
|
||||||
@ -70,7 +70,7 @@ def test_load_data_5min_ticker(ticker_history, mocker, caplog, default_conf) ->
|
|||||||
|
|
||||||
file = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'UNITTEST_BTC-5m.json')
|
file = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'UNITTEST_BTC-5m.json')
|
||||||
_backup_file(file, copy_file=True)
|
_backup_file(file, copy_file=True)
|
||||||
history.load_data(None, pairs=['UNITTEST/BTC'], ticker_interval='5m')
|
history.load_data(datadir=None, pairs=['UNITTEST/BTC'], ticker_interval='5m')
|
||||||
assert os.path.isfile(file) is True
|
assert os.path.isfile(file) is True
|
||||||
assert not log_has('Download the pair: "UNITTEST/BTC", Interval: 5m', caplog.record_tuples)
|
assert not log_has('Download the pair: "UNITTEST/BTC", Interval: 5m', caplog.record_tuples)
|
||||||
_clean_test_file(file)
|
_clean_test_file(file)
|
||||||
@ -80,7 +80,7 @@ def test_load_data_1min_ticker(ticker_history, mocker, caplog) -> None:
|
|||||||
mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history)
|
mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history)
|
||||||
file = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'UNITTEST_BTC-1m.json')
|
file = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'UNITTEST_BTC-1m.json')
|
||||||
_backup_file(file, copy_file=True)
|
_backup_file(file, copy_file=True)
|
||||||
history.load_data(None, ticker_interval='1m', pairs=['UNITTEST/BTC'])
|
history.load_data(datadir=None, ticker_interval='1m', pairs=['UNITTEST/BTC'])
|
||||||
assert os.path.isfile(file) is True
|
assert os.path.isfile(file) is True
|
||||||
assert not log_has('Download the pair: "UNITTEST/BTC", Interval: 1m', caplog.record_tuples)
|
assert not log_has('Download the pair: "UNITTEST/BTC", Interval: 1m', caplog.record_tuples)
|
||||||
_clean_test_file(file)
|
_clean_test_file(file)
|
||||||
@ -96,7 +96,7 @@ def test_load_data_with_new_pair_1min(ticker_history_list, mocker, caplog, defau
|
|||||||
|
|
||||||
_backup_file(file)
|
_backup_file(file)
|
||||||
# do not download a new pair if refresh_pairs isn't set
|
# do not download a new pair if refresh_pairs isn't set
|
||||||
history.load_data(None,
|
history.load_data(datadir=None,
|
||||||
ticker_interval='1m',
|
ticker_interval='1m',
|
||||||
refresh_pairs=False,
|
refresh_pairs=False,
|
||||||
pairs=['MEME/BTC'])
|
pairs=['MEME/BTC'])
|
||||||
@ -106,7 +106,7 @@ def test_load_data_with_new_pair_1min(ticker_history_list, mocker, caplog, defau
|
|||||||
caplog.record_tuples)
|
caplog.record_tuples)
|
||||||
|
|
||||||
# download a new pair if refresh_pairs is set
|
# download a new pair if refresh_pairs is set
|
||||||
history.load_data(None,
|
history.load_data(datadir=None,
|
||||||
ticker_interval='1m',
|
ticker_interval='1m',
|
||||||
refresh_pairs=True,
|
refresh_pairs=True,
|
||||||
exchange=exchange,
|
exchange=exchange,
|
||||||
@ -347,8 +347,8 @@ def test_load_partial_missing(caplog) -> None:
|
|||||||
caplog.clear()
|
caplog.clear()
|
||||||
start = arrow.get('2018-01-10T00:00:00')
|
start = arrow.get('2018-01-10T00:00:00')
|
||||||
end = arrow.get('2018-02-20T00:00:00')
|
end = arrow.get('2018-02-20T00:00:00')
|
||||||
tickerdata = history.load_data(None, '5m', ['UNITTEST/BTC'],
|
tickerdata = history.load_data(datadir=None, ticker_interval='5m',
|
||||||
refresh_pairs=False,
|
pairs=['UNITTEST/BTC'], refresh_pairs=False,
|
||||||
timerange=TimeRange('date', 'date',
|
timerange=TimeRange('date', 'date',
|
||||||
start.timestamp, end.timestamp))
|
start.timestamp, end.timestamp))
|
||||||
# timedifference in 5 minutes
|
# timedifference in 5 minutes
|
||||||
@ -364,7 +364,7 @@ def test_load_partial_missing(caplog) -> None:
|
|||||||
def test_init(default_conf, mocker) -> None:
|
def test_init(default_conf, mocker) -> None:
|
||||||
exchange = get_patched_exchange(mocker, default_conf)
|
exchange = get_patched_exchange(mocker, default_conf)
|
||||||
assert {} == history.load_data(
|
assert {} == history.load_data(
|
||||||
'',
|
datadir='',
|
||||||
exchange=exchange,
|
exchange=exchange,
|
||||||
pairs=[],
|
pairs=[],
|
||||||
refresh_pairs=True,
|
refresh_pairs=True,
|
||||||
|
@ -117,7 +117,7 @@ def _load_pair_as_ticks(pair, tickfreq):
|
|||||||
|
|
||||||
# FIX: fixturize this?
|
# FIX: fixturize this?
|
||||||
def _make_backtest_conf(mocker, conf=None, pair='UNITTEST/BTC', record=None):
|
def _make_backtest_conf(mocker, conf=None, pair='UNITTEST/BTC', record=None):
|
||||||
data = history.load_data(None, ticker_interval='1m', pairs=[pair])
|
data = history.load_data(datadir=None, ticker_interval='1m', pairs=[pair])
|
||||||
data = trim_dictlist(data, -201)
|
data = trim_dictlist(data, -201)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
backtesting = Backtesting(conf)
|
backtesting = Backtesting(conf)
|
||||||
@ -505,7 +505,7 @@ def test_backtest(default_conf, fee, mocker) -> None:
|
|||||||
backtesting = Backtesting(default_conf)
|
backtesting = Backtesting(default_conf)
|
||||||
pair = 'UNITTEST/BTC'
|
pair = 'UNITTEST/BTC'
|
||||||
timerange = TimeRange(None, 'line', 0, -201)
|
timerange = TimeRange(None, 'line', 0, -201)
|
||||||
data = history.load_data(None, ticker_interval='5m', pairs=['UNITTEST/BTC'],
|
data = history.load_data(datadir=None, ticker_interval='5m', pairs=['UNITTEST/BTC'],
|
||||||
timerange=timerange)
|
timerange=timerange)
|
||||||
data_processed = backtesting.strategy.tickerdata_to_dataframe(data)
|
data_processed = backtesting.strategy.tickerdata_to_dataframe(data)
|
||||||
min_date, max_date = get_timeframe(data_processed)
|
min_date, max_date = get_timeframe(data_processed)
|
||||||
@ -559,7 +559,7 @@ def test_backtest_1min_ticker_interval(default_conf, fee, mocker) -> None:
|
|||||||
|
|
||||||
# Run a backtesting for an exiting 1min ticker_interval
|
# Run a backtesting for an exiting 1min ticker_interval
|
||||||
timerange = TimeRange(None, 'line', 0, -200)
|
timerange = TimeRange(None, 'line', 0, -200)
|
||||||
data = history.load_data(None, ticker_interval='1m', pairs=['UNITTEST/BTC'],
|
data = history.load_data(datadir=None, ticker_interval='1m', pairs=['UNITTEST/BTC'],
|
||||||
timerange=timerange)
|
timerange=timerange)
|
||||||
processed = backtesting.strategy.tickerdata_to_dataframe(data)
|
processed = backtesting.strategy.tickerdata_to_dataframe(data)
|
||||||
min_date, max_date = get_timeframe(processed)
|
min_date, max_date = get_timeframe(processed)
|
||||||
@ -683,7 +683,7 @@ def test_backtest_multi_pair(default_conf, fee, mocker):
|
|||||||
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
pairs = ['ADA/BTC', 'DASH/BTC', 'ETH/BTC', 'LTC/BTC', 'NXT/BTC']
|
pairs = ['ADA/BTC', 'DASH/BTC', 'ETH/BTC', 'LTC/BTC', 'NXT/BTC']
|
||||||
data = history.load_data(None, ticker_interval='5m', pairs=pairs)
|
data = history.load_data(datadir=None, ticker_interval='5m', pairs=pairs)
|
||||||
data = trim_dictlist(data, -500)
|
data = trim_dictlist(data, -500)
|
||||||
# We need to enable sell-signal - otherwise it sells on ROI!!
|
# We need to enable sell-signal - otherwise it sells on ROI!!
|
||||||
default_conf['experimental'] = {"use_sell_signal": True}
|
default_conf['experimental'] = {"use_sell_signal": True}
|
||||||
|
@ -12,7 +12,7 @@ def test_get_timeframe(default_conf, mocker) -> None:
|
|||||||
|
|
||||||
data = strategy.tickerdata_to_dataframe(
|
data = strategy.tickerdata_to_dataframe(
|
||||||
history.load_data(
|
history.load_data(
|
||||||
None,
|
datadir=None,
|
||||||
ticker_interval='1m',
|
ticker_interval='1m',
|
||||||
pairs=['UNITTEST/BTC']
|
pairs=['UNITTEST/BTC']
|
||||||
)
|
)
|
||||||
@ -28,7 +28,7 @@ def test_validate_backtest_data_warn(default_conf, mocker, caplog) -> None:
|
|||||||
|
|
||||||
data = strategy.tickerdata_to_dataframe(
|
data = strategy.tickerdata_to_dataframe(
|
||||||
history.load_data(
|
history.load_data(
|
||||||
None,
|
datadir=None,
|
||||||
ticker_interval='1m',
|
ticker_interval='1m',
|
||||||
pairs=['UNITTEST/BTC']
|
pairs=['UNITTEST/BTC']
|
||||||
)
|
)
|
||||||
@ -50,7 +50,7 @@ def test_validate_backtest_data(default_conf, mocker, caplog) -> None:
|
|||||||
timerange = TimeRange('index', 'index', 200, 250)
|
timerange = TimeRange('index', 'index', 200, 250)
|
||||||
data = strategy.tickerdata_to_dataframe(
|
data = strategy.tickerdata_to_dataframe(
|
||||||
history.load_data(
|
history.load_data(
|
||||||
None,
|
datadir=None,
|
||||||
ticker_interval='5m',
|
ticker_interval='5m',
|
||||||
pairs=['UNITTEST/BTC'],
|
pairs=['UNITTEST/BTC'],
|
||||||
timerange=timerange
|
timerange=timerange
|
||||||
|
Loading…
Reference in New Issue
Block a user