review comments and update test for exit signals

This commit is contained in:
jainanuj94 2024-08-06 12:55:48 +05:30
parent 103991746b
commit 3ebc5b136c
3 changed files with 7 additions and 7 deletions

View File

@ -18,7 +18,7 @@ freqtrade backtesting -c <config.json> --timeframe <tf> --strategy <strategy_nam
```
This will tell freqtrade to output a pickled dictionary of strategy, pairs and corresponding
DataFrame of the candles that resulted in buy and sell signals.
DataFrame of the candles that resulted in entry and exit signals.
Depending on how many buys your strategy makes, this file may get quite large,
so periodically check your `user_data/backtest_results` folder to delete old exports.

View File

@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
def generate_trade_signal_candles(
preprocessed_df: Dict[str, DataFrame], bt_results: Dict[str, Any], analysis_on="open_date"
preprocessed_df: Dict[str, DataFrame], bt_results: Dict[str, Any], analysis_on: str
) -> Dict[str, DataFrame]:
signal_candles_only = {}
for pair in preprocessed_df.keys():

View File

@ -18,7 +18,9 @@ def entryexitanalysis_cleanup() -> None:
Backtesting.cleanup()
def test_backtest_analysis_nomock(default_conf, mocker, caplog, testdatadir, user_dir, capsys):
def test_backtest_analysis_on_entry_and_rejected_signals_nomock(
default_conf, mocker, caplog, testdatadir, user_dir, capsys
):
caplog.set_level(logging.INFO)
(user_dir / "backtest_results").mkdir(parents=True, exist_ok=True)
@ -140,7 +142,6 @@ def test_backtest_analysis_nomock(default_conf, mocker, caplog, testdatadir, use
)
start_analysis_entries_exits(args)
captured = capsys.readouterr()
assert "Analysing on exit signals." not in captured.out
assert "LTC/BTC" in captured.out
assert "ETH/BTC" in captured.out
assert "enter_tag_long_a" in captured.out
@ -279,7 +280,7 @@ def test_backtest_analysis_on_exit_signals_nomock(
),
"close_date": pd.to_datetime(
[
"2018-01-29 20:45:00",
"2018-01-30 20:45:00",
"2018-01-30 05:35:00",
"2018-01-30 09:10:00",
"2018-01-31 15:00:00",
@ -381,7 +382,6 @@ def test_backtest_analysis_on_exit_signals_nomock(
)
start_analysis_entries_exits(args)
captured = capsys.readouterr()
assert "Analysing on exit signals." in captured.out
assert "LTC/BTC" in captured.out
assert "ETH/BTC" in captured.out
assert "enter_tag_long_a" in captured.out
@ -394,7 +394,7 @@ def test_backtest_analysis_on_exit_signals_nomock(
assert "-4" in captured.out
assert "-2" in captured.out
assert "57.654" in captured.out
assert "44.428" in captured.out
assert "-8" in captured.out
assert "0" in captured.out
assert "0.104" in captured.out
assert "0.016" in captured.out