Merge pull request #9961 from hippocritical/develop

tiny bugfix for lookahead-analysis
This commit is contained in:
Matthias
2024-03-17 13:55:22 +01:00
committed by GitHub
2 changed files with 12 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ It also supports the lookahead-analysis of freqai strategies.
- `--max-open-trades` is forced to be at least equal to the number of pairs.
- `--dry-run-wallet` is forced to be basically infinite (1 billion).
- `--stake-amount` is forced to be a static 10000 (10k).
- `--enable-protections` is forced to be off.
Those are set to avoid users accidentally generating false positives.
@@ -40,7 +41,6 @@ usage: freqtrade lookahead-analysis [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[--max-open-trades INT]
[--stake-amount STAKE_AMOUNT]
[--fee FLOAT] [-p PAIRS [PAIRS ...]]
[--enable-protections]
[--dry-run-wallet DRY_RUN_WALLET]
[--timeframe-detail TIMEFRAME_DETAIL]
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]

View File

@@ -121,14 +121,22 @@ class LookaheadAnalysisSubFunctions:
@staticmethod
def calculate_config_overrides(config: Config):
if config.get('enable_protections', False):
# if protections are used globally, they can produce false positives.
config['enable_protections'] = False
logger.info('Protections were enabled. '
'Disabling protections now '
'since they could otherwise produce false positives.')
if config['targeted_trade_amount'] < config['minimum_trade_amount']:
# this combo doesn't make any sense.
raise OperationalException(
"Targeted trade amount can't be smaller than minimum trade amount."
)
if len(config['pairs']) > config['max_open_trades']:
logger.info('Max_open_trades were less than amount of pairs. '
'Set max_open_trades to amount of pairs just to avoid false positives.')
if len(config['pairs']) > config.get('max_open_trades', 0):
logger.info('Max_open_trades were less than amount of pairs '
'or defined in the strategy. '
'Set max_open_trades to amount of pairs '
'just to avoid false positives.')
config['max_open_trades'] = len(config['pairs'])
min_dry_run_wallet = 1000000000