From 09308e568d1b8c40b71979b55f4417f48d3c593a Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 27 Nov 2024 07:14:11 +0100 Subject: [PATCH] fix: increase code reliability by not relying on stake-currency to be in the dict --- freqtrade/wallets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/freqtrade/wallets.py b/freqtrade/wallets.py index 39b7070ec..9864d0604 100644 --- a/freqtrade/wallets.py +++ b/freqtrade/wallets.py @@ -125,7 +125,9 @@ class Wallets: trade.amount + curr_wallet_bal, ) - current_stake = self._start_cap[self._stake_currency] + tot_profit - tot_in_trades + current_stake = ( + self._start_cap.get(self._stake_currency, 0) + tot_profit - tot_in_trades + ) total_stake = current_stake + used_stake else: tot_in_trades = 0 @@ -142,7 +144,9 @@ class Wallets: collateral=collateral, side=position.trade_direction, ) - current_stake = self._start_cap[self._stake_currency] + tot_profit - tot_in_trades + current_stake = ( + self._start_cap.get(self._stake_currency, 0) + tot_profit - tot_in_trades + ) used_stake = tot_in_trades total_stake = current_stake + tot_in_trades