From a27c837d183d6f8479e0816a6c9fafe3daaba524 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 3 Apr 2022 10:41:35 +0200 Subject: [PATCH] Update sell_reason to exit_reason --- docs/strategy_analysis_example.md | 2 +- freqtrade/persistence/models.py | 10 +++++----- freqtrade/rpc/rpc.py | 2 +- freqtrade/templates/strategy_analysis_example.ipynb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/strategy_analysis_example.md b/docs/strategy_analysis_example.md index 5c01ab2cb..2fa84a6df 100644 --- a/docs/strategy_analysis_example.md +++ b/docs/strategy_analysis_example.md @@ -182,7 +182,7 @@ from freqtrade.data.btanalysis import load_trades_from_db trades = load_trades_from_db("sqlite:///tradesv3.sqlite") # Display results -trades.groupby("pair")["sell_reason"].value_counts() +trades.groupby("pair")["exit_reason"].value_counts() ``` ## Analyze the loaded trades for trade parallelism diff --git a/freqtrade/persistence/models.py b/freqtrade/persistence/models.py index 9c5f7da86..a753db44a 100644 --- a/freqtrade/persistence/models.py +++ b/freqtrade/persistence/models.py @@ -1324,7 +1324,7 @@ class Trade(_DECL_BASE, LocalTrade): @staticmethod def get_mix_tag_performance(pair: Optional[str]) -> List[Dict[str, Any]]: """ - Returns List of dicts containing all Trades, based on buy_tag + sell_reason performance + Returns List of dicts containing all Trades, based on entry_tag + exit_reason performance Can either be average for all pairs or a specific pair provided NOTE: Not supported in Backtesting. """ @@ -1346,12 +1346,12 @@ class Trade(_DECL_BASE, LocalTrade): .all() return_list: List[Dict] = [] - for id, enter_tag, sell_reason, profit, profit_abs, count in mix_tag_perf: + for id, enter_tag, exit_reason, profit, profit_abs, count in mix_tag_perf: enter_tag = enter_tag if enter_tag is not None else "Other" - sell_reason = sell_reason if sell_reason is not None else "Other" + exit_reason = exit_reason if exit_reason is not None else "Other" - if(sell_reason is not None and enter_tag is not None): - mix_tag = enter_tag + " " + sell_reason + if(exit_reason is not None and enter_tag is not None): + mix_tag = enter_tag + " " + exit_reason i = 0 if not any(item["mix_tag"] == mix_tag for item in return_list): return_list.append({'mix_tag': mix_tag, diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 56e96f4d7..7b34354c3 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -857,7 +857,7 @@ class RPC: def _rpc_mix_tag_performance(self, pair: Optional[str]) -> List[Dict[str, Any]]: """ - Handler for mix tag (enter_tag + sell_reason) performance. + Handler for mix tag (enter_tag + exit_reason) performance. Shows a performance statistic from finished trades """ mix_tags = Trade.get_mix_tag_performance(pair) diff --git a/freqtrade/templates/strategy_analysis_example.ipynb b/freqtrade/templates/strategy_analysis_example.ipynb index 082961ba2..93e4b83ae 100644 --- a/freqtrade/templates/strategy_analysis_example.ipynb +++ b/freqtrade/templates/strategy_analysis_example.ipynb @@ -257,7 +257,7 @@ "trades = load_trades_from_db(\"sqlite:///tradesv3.sqlite\")\n", "\n", "# Display results\n", - "trades.groupby(\"pair\")[\"sell_reason\"].value_counts()" + "trades.groupby(\"pair\")[\"exit_reason\"].value_counts()" ] }, {