Replace 'ETH/BTC' with 'UNITTEST/BTC' to fix adx not generating if ETH/BTC ticker history is too short
This commit is contained in:
parent
cbc0b81d2e
commit
616006caf8
@ -54,7 +54,7 @@ def default_conf():
|
|||||||
"stake_currency": "BTC",
|
"stake_currency": "BTC",
|
||||||
"stake_amount": 0.001,
|
"stake_amount": 0.001,
|
||||||
"fiat_display_currency": "USD",
|
"fiat_display_currency": "USD",
|
||||||
"ticker_interval": 5,
|
"ticker_interval": '5m',
|
||||||
"dry_run": True,
|
"dry_run": True,
|
||||||
"minimal_roi": {
|
"minimal_roi": {
|
||||||
"40": 0.0,
|
"40": 0.0,
|
||||||
@ -323,10 +323,9 @@ def ticker_history_without_bv():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# FIX: Perhaps change result fixture to use UNITTEST/BTC instead?
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def result():
|
def result():
|
||||||
with open('freqtrade/tests/testdata/ETH_BTC-1.json') as data_file:
|
with open('freqtrade/tests/testdata/UNITTEST_BTC-1m.json') as data_file:
|
||||||
return Analyze.parse_ticker_dataframe(json.load(data_file))
|
return Analyze.parse_ticker_dataframe(json.load(data_file))
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ def trim_dictlist(dict_list, num):
|
|||||||
|
|
||||||
def load_data_test(what):
|
def load_data_test(what):
|
||||||
timerange = ((None, 'line'), None, -100)
|
timerange = ((None, 'line'), None, -100)
|
||||||
data = optimize.load_data(None, ticker_interval=1, pairs=['UNITTEST/BTC'], timerange=timerange)
|
data = optimize.load_data(None, ticker_interval='1m', pairs=['UNITTEST/BTC'], timerange=timerange)
|
||||||
pair = data['UNITTEST/BTC']
|
pair = data['UNITTEST/BTC']
|
||||||
datalen = len(pair)
|
datalen = len(pair)
|
||||||
# Depending on the what parameter we now adjust the
|
# Depending on the what parameter we now adjust the
|
||||||
@ -93,8 +93,8 @@ def simple_backtest(config, contour, num_results) -> None:
|
|||||||
assert len(results) == num_results
|
assert len(results) == num_results
|
||||||
|
|
||||||
|
|
||||||
def mocked_load_data(datadir, pairs=[], ticker_interval=0, refresh_pairs=False, timerange=None):
|
def mocked_load_data(datadir, pairs=[], ticker_interval='0m', refresh_pairs=False, timerange=None):
|
||||||
tickerdata = optimize.load_tickerdata_file(datadir, 'UNITTEST/BTC', 1, timerange=timerange)
|
tickerdata = optimize.load_tickerdata_file(datadir, 'UNITTEST/BTC', '1m', timerange=timerange)
|
||||||
pairdata = {'UNITTEST/BTC': tickerdata}
|
pairdata = {'UNITTEST/BTC': tickerdata}
|
||||||
return pairdata
|
return pairdata
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ def _load_pair_as_ticks(pair, tickfreq):
|
|||||||
|
|
||||||
# FIX: fixturize this?
|
# FIX: fixturize this?
|
||||||
def _make_backtest_conf(conf=None, pair='UNITTEST/BTC', record=None):
|
def _make_backtest_conf(conf=None, pair='UNITTEST/BTC', record=None):
|
||||||
data = optimize.load_data(None, ticker_interval=8, pairs=[pair])
|
data = optimize.load_data(None, ticker_interval='8m', pairs=[pair])
|
||||||
data = trim_dictlist(data, -200)
|
data = trim_dictlist(data, -200)
|
||||||
return {
|
return {
|
||||||
'stake_amount': conf['stake_amount'],
|
'stake_amount': conf['stake_amount'],
|
||||||
@ -218,7 +218,7 @@ def test_setup_configuration_with_arguments(mocker, default_conf, caplog) -> Non
|
|||||||
'--strategy', 'default_strategy',
|
'--strategy', 'default_strategy',
|
||||||
'--datadir', '/foo/bar',
|
'--datadir', '/foo/bar',
|
||||||
'backtesting',
|
'backtesting',
|
||||||
'--ticker-interval', '1',
|
'--ticker-interval', '1m',
|
||||||
'--live',
|
'--live',
|
||||||
'--realistic-simulation',
|
'--realistic-simulation',
|
||||||
'--refresh-pairs-cached',
|
'--refresh-pairs-cached',
|
||||||
@ -240,7 +240,7 @@ def test_setup_configuration_with_arguments(mocker, default_conf, caplog) -> Non
|
|||||||
assert 'ticker_interval' in config
|
assert 'ticker_interval' in config
|
||||||
assert log_has('Parameter -i/--ticker-interval detected ...', caplog.record_tuples)
|
assert log_has('Parameter -i/--ticker-interval detected ...', caplog.record_tuples)
|
||||||
assert log_has(
|
assert log_has(
|
||||||
'Using ticker_interval: 1 ...',
|
'Using ticker_interval: 1m ...',
|
||||||
caplog.record_tuples
|
caplog.record_tuples
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ def test_backtesting_init(default_conf) -> None:
|
|||||||
backtesting = Backtesting(default_conf)
|
backtesting = Backtesting(default_conf)
|
||||||
assert backtesting.config == default_conf
|
assert backtesting.config == default_conf
|
||||||
assert isinstance(backtesting.analyze, Analyze)
|
assert isinstance(backtesting.analyze, Analyze)
|
||||||
assert backtesting.ticker_interval == 5
|
assert backtesting.ticker_interval == '5m'
|
||||||
assert callable(backtesting.tickerdata_to_dataframe)
|
assert callable(backtesting.tickerdata_to_dataframe)
|
||||||
assert callable(backtesting.populate_buy_trend)
|
assert callable(backtesting.populate_buy_trend)
|
||||||
assert callable(backtesting.populate_sell_trend)
|
assert callable(backtesting.populate_sell_trend)
|
||||||
@ -325,7 +325,7 @@ def test_tickerdata_to_dataframe(default_conf) -> None:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
timerange = ((None, 'line'), None, -100)
|
timerange = ((None, 'line'), None, -100)
|
||||||
tick = optimize.load_tickerdata_file(None, 'UNITTEST/BTC', 1, timerange=timerange)
|
tick = optimize.load_tickerdata_file(None, 'UNITTEST/BTC', '1m', timerange=timerange)
|
||||||
tickerlist = {'UNITTEST/BTC': tick}
|
tickerlist = {'UNITTEST/BTC': tick}
|
||||||
|
|
||||||
backtesting = _BACKTESTING
|
backtesting = _BACKTESTING
|
||||||
@ -347,7 +347,7 @@ def test_get_timeframe() -> None:
|
|||||||
data = backtesting.tickerdata_to_dataframe(
|
data = backtesting.tickerdata_to_dataframe(
|
||||||
optimize.load_data(
|
optimize.load_data(
|
||||||
None,
|
None,
|
||||||
ticker_interval=1,
|
ticker_interval='1m',
|
||||||
pairs=['UNITTEST/BTC']
|
pairs=['UNITTEST/BTC']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -432,7 +432,7 @@ def test_backtest(default_conf) -> None:
|
|||||||
"""
|
"""
|
||||||
backtesting = _BACKTESTING
|
backtesting = _BACKTESTING
|
||||||
|
|
||||||
data = optimize.load_data(None, ticker_interval=5, pairs=['ETH/BTC'])
|
data = optimize.load_data(None, ticker_interval='5m', pairs=['UNITTEST/BTC'])
|
||||||
data = trim_dictlist(data, -200)
|
data = trim_dictlist(data, -200)
|
||||||
results = backtesting.backtest(
|
results = backtesting.backtest(
|
||||||
{
|
{
|
||||||
@ -452,7 +452,7 @@ def test_backtest_1min_ticker_interval(default_conf) -> None:
|
|||||||
backtesting = _BACKTESTING
|
backtesting = _BACKTESTING
|
||||||
|
|
||||||
# Run a backtesting for an exiting 5min ticker_interval
|
# Run a backtesting for an exiting 5min ticker_interval
|
||||||
data = optimize.load_data(None, ticker_interval=1, pairs=['UNITTEST/BTC'])
|
data = optimize.load_data(None, ticker_interval='1m', pairs=['UNITTEST/BTC'])
|
||||||
data = trim_dictlist(data, -200)
|
data = trim_dictlist(data, -200)
|
||||||
results = backtesting.backtest(
|
results = backtesting.backtest(
|
||||||
{
|
{
|
||||||
@ -585,7 +585,7 @@ def test_backtest_start_live(default_conf, mocker, caplog):
|
|||||||
'--config', 'config.json',
|
'--config', 'config.json',
|
||||||
'--strategy', 'default_strategy',
|
'--strategy', 'default_strategy',
|
||||||
'backtesting',
|
'backtesting',
|
||||||
'--ticker-interval', '1',
|
'--ticker-interval', '1m',
|
||||||
'--live',
|
'--live',
|
||||||
'--timerange', '-100'
|
'--timerange', '-100'
|
||||||
]
|
]
|
||||||
@ -594,7 +594,7 @@ def test_backtest_start_live(default_conf, mocker, caplog):
|
|||||||
# check the logs, that will contain the backtest result
|
# check the logs, that will contain the backtest result
|
||||||
exists = [
|
exists = [
|
||||||
'Parameter -i/--ticker-interval detected ...',
|
'Parameter -i/--ticker-interval detected ...',
|
||||||
'Using ticker_interval: 1 ...',
|
'Using ticker_interval: 1m ...',
|
||||||
'Parameter -l/--live detected ...',
|
'Parameter -l/--live detected ...',
|
||||||
'Using max_open_trades: 1 ...',
|
'Using max_open_trades: 1 ...',
|
||||||
'Parameter --timerange detected: -100 ..',
|
'Parameter --timerange detected: -100 ..',
|
||||||
|
1
freqtrade/tests/testdata/UNITTEST_BTC-5m.json
vendored
Normal file
1
freqtrade/tests/testdata/UNITTEST_BTC-5m.json
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user