chore: calculate total_stake only once

This commit is contained in:
Matthias
2024-12-08 14:37:10 +01:00
parent d0223e6f48
commit 58357a0746

View File

@@ -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,