From 58357a074641d885dcfc521e18b58f27c96b422f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Dec 2024 14:37:10 +0100 Subject: [PATCH] chore: calculate total_stake only once --- freqtrade/wallets.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/freqtrade/wallets.py b/freqtrade/wallets.py index f53c26255..fb27d5e5d 100644 --- a/freqtrade/wallets.py +++ b/freqtrade/wallets.py @@ -124,11 +124,6 @@ class Wallets: pending, trade.amount + curr_wallet_bal, ) - - current_stake = ( - self._start_cap.get(self._stake_currency, 0) + tot_profit - tot_in_trades - ) - total_stake = current_stake + used_stake else: for position in open_trades: _positions[position.pair] = PositionWallet( @@ -138,12 +133,11 @@ class Wallets: collateral=position.stake_amount, side=position.trade_direction, ) - 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 + + current_stake = self._start_cap.get(self._stake_currency, 0) + tot_profit - tot_in_trades + total_stake = current_stake + used_stake _wallets[self._stake_currency] = Wallet( currency=self._stake_currency,