From 3fc259bb9b57995889feb0489f8fa00f1bc52ffa Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 26 Nov 2024 07:23:57 +0100 Subject: [PATCH] feat: add non-trading balance to wallet --- freqtrade/wallets.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/freqtrade/wallets.py b/freqtrade/wallets.py index ec79e25e3..39b7070ec 100644 --- a/freqtrade/wallets.py +++ b/freqtrade/wallets.py @@ -116,8 +116,14 @@ class Wallets: for o in trade.open_orders if o.amount and o.ft_order_side == trade.exit_side ) + curr_wallet_bal = self._start_cap.get(curr, 0) - _wallets[curr] = Wallet(curr, trade.amount - pending, pending, trade.amount) + _wallets[curr] = Wallet( + curr, + curr_wallet_bal + trade.amount - pending, + pending, + trade.amount + curr_wallet_bal, + ) current_stake = self._start_cap[self._stake_currency] + tot_profit - tot_in_trades total_stake = current_stake + used_stake @@ -147,6 +153,11 @@ class Wallets: used=used_stake, total=total_stake, ) + for currency in self._start_cap: + if currency not in _wallets: + bal = self._start_cap[currency] + _wallets[currency] = Wallet(currency, bal, 0, bal) + self._wallets = _wallets self._positions = _positions