Merge branch 'develop' into feat/short
This commit is contained in:
commit
dad080f56f
@ -284,8 +284,8 @@ class Backtesting:
|
|||||||
{'pair': pair}
|
{'pair': pair}
|
||||||
).copy()
|
).copy()
|
||||||
# Trim startup period from analyzed dataframe
|
# Trim startup period from analyzed dataframe
|
||||||
df_analyzed = trim_dataframe(df_analyzed, self.timerange,
|
df_analyzed = processed[pair] = pair_data = trim_dataframe(
|
||||||
startup_candles=self.required_startup)
|
df_analyzed, self.timerange, startup_candles=self.required_startup)
|
||||||
# To avoid using data from future, we use buy/sell signals shifted
|
# To avoid using data from future, we use buy/sell signals shifted
|
||||||
# from the previous candle
|
# from the previous candle
|
||||||
for col in headers[5:]:
|
for col in headers[5:]:
|
||||||
@ -303,9 +303,6 @@ class Backtesting:
|
|||||||
# Convert from Pandas to list for performance reasons
|
# Convert from Pandas to list for performance reasons
|
||||||
# (Looping Pandas is slow.)
|
# (Looping Pandas is slow.)
|
||||||
data[pair] = df_analyzed[headers].values.tolist()
|
data[pair] = df_analyzed[headers].values.tolist()
|
||||||
|
|
||||||
# Do not hold on to old data to reduce memory usage
|
|
||||||
processed[pair] = pair_data = None
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _get_close_rate(self, sell_row: Tuple, trade: LocalTrade, sell: SellCheckTuple,
|
def _get_close_rate(self, sell_row: Tuple, trade: LocalTrade, sell: SellCheckTuple,
|
||||||
|
@ -648,7 +648,12 @@ def text_table_strategy(strategy_results, stake_currency: str) -> str:
|
|||||||
headers.append('Drawdown')
|
headers.append('Drawdown')
|
||||||
|
|
||||||
# Align drawdown string on the center two space separator.
|
# Align drawdown string on the center two space separator.
|
||||||
drawdown = [f'{t["max_drawdown_account"] * 100:.2f}' for t in strategy_results]
|
if 'max_drawdown_account' in strategy_results[0]:
|
||||||
|
drawdown = [f'{t["max_drawdown_account"] * 100:.2f}' for t in strategy_results]
|
||||||
|
else:
|
||||||
|
# Support for prior backtest results
|
||||||
|
drawdown = [f'{t["max_drawdown_per"]:.2f}' for t in strategy_results]
|
||||||
|
|
||||||
dd_pad_abs = max([len(t['max_drawdown_abs']) for t in strategy_results])
|
dd_pad_abs = max([len(t['max_drawdown_abs']) for t in strategy_results])
|
||||||
dd_pad_per = max([len(dd) for dd in drawdown])
|
dd_pad_per = max([len(dd) for dd in drawdown])
|
||||||
drawdown = [f'{t["max_drawdown_abs"]:>{dd_pad_abs}} {stake_currency} {dd:>{dd_pad_per}}%'
|
drawdown = [f'{t["max_drawdown_abs"]:>{dd_pad_abs}} {stake_currency} {dd:>{dd_pad_per}}%'
|
||||||
|
@ -63,6 +63,7 @@ EXCHANGES = {
|
|||||||
},
|
},
|
||||||
'bitvavo': {
|
'bitvavo': {
|
||||||
'pair': 'BTC/EUR',
|
'pair': 'BTC/EUR',
|
||||||
|
'stake_currency': 'EUR',
|
||||||
'hasQuoteVolume': True,
|
'hasQuoteVolume': True,
|
||||||
'timeframe': '5m',
|
'timeframe': '5m',
|
||||||
},
|
},
|
||||||
@ -82,6 +83,8 @@ def exchange_conf():
|
|||||||
@pytest.fixture(params=EXCHANGES, scope="class")
|
@pytest.fixture(params=EXCHANGES, scope="class")
|
||||||
def exchange(request, exchange_conf):
|
def exchange(request, exchange_conf):
|
||||||
exchange_conf['exchange']['name'] = request.param
|
exchange_conf['exchange']['name'] = request.param
|
||||||
|
exchange_conf['stake_currency'] = EXCHANGES[request.param].get(
|
||||||
|
'stake_currency', exchange_conf['stake_currency'])
|
||||||
exchange = ExchangeResolver.load_exchange(request.param, exchange_conf, validate=True)
|
exchange = ExchangeResolver.load_exchange(request.param, exchange_conf, validate=True)
|
||||||
|
|
||||||
yield exchange, request.param
|
yield exchange, request.param
|
||||||
|
@ -191,8 +191,8 @@ def test_start_no_hyperopt_allowed(mocker, hyperopt_conf, caplog) -> None:
|
|||||||
start_hyperopt(pargs)
|
start_hyperopt(pargs)
|
||||||
|
|
||||||
|
|
||||||
def test_start_no_data(mocker, hyperopt_conf) -> None:
|
def test_start_no_data(mocker, hyperopt_conf, tmpdir) -> None:
|
||||||
hyperopt_conf['user_data_dir'] = Path("tests")
|
hyperopt_conf['user_data_dir'] = Path(tmpdir)
|
||||||
patched_configuration_load_config_file(mocker, hyperopt_conf)
|
patched_configuration_load_config_file(mocker, hyperopt_conf)
|
||||||
mocker.patch('freqtrade.data.history.load_pair_history', MagicMock(return_value=pd.DataFrame))
|
mocker.patch('freqtrade.data.history.load_pair_history', MagicMock(return_value=pd.DataFrame))
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
@ -201,7 +201,6 @@ def test_start_no_data(mocker, hyperopt_conf) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
# TODO: migrate to strategy-based hyperopt
|
|
||||||
args = [
|
args = [
|
||||||
'hyperopt',
|
'hyperopt',
|
||||||
'--config', 'config.json',
|
'--config', 'config.json',
|
||||||
|
Loading…
Reference in New Issue
Block a user