use BT_DATA_COLUMNS for trade wide indicators

This commit is contained in:
Anuj Jain 2024-09-06 12:28:02 +05:30
parent b7145debfb
commit 8d96844312
2 changed files with 6 additions and 11 deletions

View File

@ -145,8 +145,10 @@ The `(entry)` and `(exit)` suffixes are added to indicators
to distinguish the values at the entry and exit points of the trade.
!!! note "Trade-wide Indicators"
Certain trade-wide indicators do not have the `(entry)` or `(exit)` suffix. These indicators include:
`"open_date"`, `"close_date"`, `"min_rate"`, `"max_rate"`, `"profit_ratio"`, and `"profit_abs"`.
Certain trade-wide indicators do not have the `(entry)` or `(exit)` suffix. These indicators include: `pair`, `stake_amount`,
`max_stake_amount`, `amount`, `open_date`, `close_date`, `open_rate`, `close_rate`, `fee_open`, `fee_close`, `trade_duration`,
`profit_ratio`, `profit_abs`, `exit_reason`,`initial_stop_loss_abs`, `initial_stop_loss_ratio`, `stop_loss_abs`, `stop_loss_ratio`,
`min_rate`, `max_rate`, `is_open`, `enter_tag`, `leverage`, `is_short`, `open_timestamp`, `close_timestamp` and `orders`
### Filtering the trade output by date

View File

@ -8,6 +8,7 @@ import pandas as pd
from freqtrade.configuration import TimeRange
from freqtrade.constants import Config
from freqtrade.data.btanalysis import (
BT_DATA_COLUMNS,
get_latest_backtest_filename,
load_backtest_data,
load_backtest_stats,
@ -303,15 +304,7 @@ def print_results(
def _merge_dfs(entry_df, exit_df, available_inds):
merge_on = ["pair", "open_date"]
trade_wide_indicators = [
"open_date",
"close_date",
"min_rate",
"max_rate",
"profit_ratio",
"profit_abs",
]
signal_wide_indicators = list(set(available_inds) - set(trade_wide_indicators))
signal_wide_indicators = list(set(available_inds) - set(BT_DATA_COLUMNS))
columns_to_keep = merge_on + ["enter_reason", "exit_reason"] + available_inds
if exit_df is None or exit_df.empty: