diff --git a/freqtrade/wallets.py b/freqtrade/wallets.py index 75bd9a505..4dcdb4ee4 100644 --- a/freqtrade/wallets.py +++ b/freqtrade/wallets.py @@ -136,12 +136,22 @@ class Wallets: used_stake = tot_in_trades + cross_margin = 0.0 + if self._config.get("margin_mode") == "cross": + # In cross-margin mode, the total balance is used as collateral. + for curr, bal in self._start_cap.items(): + if curr == self._stake_currency: + continue + rate = self._exchange.get_conversion_rate(curr, self._stake_currency) + if rate: + cross_margin += bal * rate + 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, - free=current_stake, + free=current_stake + cross_margin, used=used_stake, total=total_stake, )