feat: reuse exchange secrets for exchange credential removal

This commit is contained in:
Matthias
2025-06-20 20:23:22 +02:00
parent 2165c3e542
commit 3465f35d75
+10 -6
View File
@@ -54,10 +54,14 @@ def remove_exchange_credentials(exchange_config: ExchangeConfig, dry_run: bool)
Removes exchange keys from the configuration and specifies dry-run Removes exchange keys from the configuration and specifies dry-run
Used for backtesting / hyperopt and utils. Used for backtesting / hyperopt and utils.
Modifies the input dict! Modifies the input dict!
:param exchange_config: Exchange configuration
:param dry_run: If True, remove sensitive keys from the exchange configuration
""" """
if dry_run: if not dry_run:
exchange_config["key"] = "" return
exchange_config["apiKey"] = ""
exchange_config["secret"] = "" for key in [k for k in _SENSITIVE_KEYS if k.startswith("exchange.")]:
exchange_config["password"] = "" if "." in key:
exchange_config["uid"] = "" key1 = key.removeprefix("exchange.")
if key1 in exchange_config:
exchange_config[key1] = ""