Skip to content

Commit 3465f35

Browse files
committed
feat: reuse exchange secrets for exchange credential removal
1 parent 2165c3e commit 3465f35

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

freqtrade/configuration/config_secrets.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ def remove_exchange_credentials(exchange_config: ExchangeConfig, dry_run: bool)
5454
Removes exchange keys from the configuration and specifies dry-run
5555
Used for backtesting / hyperopt and utils.
5656
Modifies the input dict!
57+
:param exchange_config: Exchange configuration
58+
:param dry_run: If True, remove sensitive keys from the exchange configuration
5759
"""
58-
if dry_run:
59-
exchange_config["key"] = ""
60-
exchange_config["apiKey"] = ""
61-
exchange_config["secret"] = ""
62-
exchange_config["password"] = ""
63-
exchange_config["uid"] = ""
60+
if not dry_run:
61+
return
62+
63+
for key in [k for k in _SENSITIVE_KEYS if k.startswith("exchange.")]:
64+
if "." in key:
65+
key1 = key.removeprefix("exchange.")
66+
if key1 in exchange_config:
67+
exchange_config[key1] = ""

0 commit comments

Comments
 (0)