Add relevant parameters to stored backtest result
This commit is contained in:
parent
fa18274e9a
commit
378f03a5b1
@ -277,6 +277,16 @@ def generate_backtest_stats(config: Dict, btdata: Dict[str, DataFrame],
|
|||||||
'max_open_trades': (config['max_open_trades']
|
'max_open_trades': (config['max_open_trades']
|
||||||
if config['max_open_trades'] != float('inf') else -1),
|
if config['max_open_trades'] != float('inf') else -1),
|
||||||
'timeframe': config['timeframe'],
|
'timeframe': config['timeframe'],
|
||||||
|
# Parameters relevant for backtesting
|
||||||
|
'stoploss': config['stoploss'],
|
||||||
|
'trailing_stop': config.get('trailing_stop', False),
|
||||||
|
'trailing_stop_positive': config.get('trailing_stop_positive'),
|
||||||
|
'trailing_stop_positive_offset': config.get('trailing_stop_positive_offset', 0.0),
|
||||||
|
'trailing_only_offset_is_reached': config.get('trailing_only_offset_is_reached', False),
|
||||||
|
'minimal_roi': config['minimal_roi'],
|
||||||
|
'use_sell_signal': config['ask_strategy']['use_sell_signal'],
|
||||||
|
'sell_profit_only': config['ask_strategy']['sell_profit_only'],
|
||||||
|
'ignore_roi_if_buy_signal': config['ask_strategy']['ignore_roi_if_buy_signal'],
|
||||||
**daily_stats,
|
**daily_stats,
|
||||||
}
|
}
|
||||||
result['strategy'][strategy] = strat_stats
|
result['strategy'][strategy] = strat_stats
|
||||||
|
@ -5,7 +5,6 @@ from pathlib import Path
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import pytest
|
import pytest
|
||||||
from arrow import Arrow
|
from arrow import Arrow
|
||||||
|
|
||||||
from freqtrade.configuration import TimeRange
|
from freqtrade.configuration import TimeRange
|
||||||
from freqtrade.constants import LAST_BT_RESULT_FN
|
from freqtrade.constants import LAST_BT_RESULT_FN
|
||||||
from freqtrade.data import history
|
from freqtrade.data import history
|
||||||
@ -22,6 +21,7 @@ from freqtrade.optimize.optimize_reports import (generate_backtest_stats,
|
|||||||
text_table_bt_results,
|
text_table_bt_results,
|
||||||
text_table_sell_reason,
|
text_table_sell_reason,
|
||||||
text_table_strategy)
|
text_table_strategy)
|
||||||
|
from freqtrade.resolvers.strategy_resolver import StrategyResolver
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from tests.data.test_history import _backup_file, _clean_test_file
|
from tests.data.test_history import _backup_file, _clean_test_file
|
||||||
|
|
||||||
@ -57,6 +57,9 @@ def test_text_table_bt_results(default_conf, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_generate_backtest_stats(default_conf, testdatadir):
|
def test_generate_backtest_stats(default_conf, testdatadir):
|
||||||
|
default_conf.update({'strategy': 'DefaultStrategy'})
|
||||||
|
StrategyResolver.load_strategy(default_conf)
|
||||||
|
|
||||||
results = {'DefStrat': pd.DataFrame({"pair": ["UNITTEST/BTC", "UNITTEST/BTC",
|
results = {'DefStrat': pd.DataFrame({"pair": ["UNITTEST/BTC", "UNITTEST/BTC",
|
||||||
"UNITTEST/BTC", "UNITTEST/BTC"],
|
"UNITTEST/BTC", "UNITTEST/BTC"],
|
||||||
"profit_percent": [0.003312, 0.010801, 0.013803, 0.002780],
|
"profit_percent": [0.003312, 0.010801, 0.013803, 0.002780],
|
||||||
|
Loading…
Reference in New Issue
Block a user