diff --git a/freqtrade/exchange/binance.py b/freqtrade/exchange/binance.py index 637bfafef..bb3520cda 100644 --- a/freqtrade/exchange/binance.py +++ b/freqtrade/exchange/binance.py @@ -153,7 +153,7 @@ class Binance(Exchange): stake_amount: float, leverage: float, wallet_balance: float, # Or margin balance - other_trades: list, + open_trades: list, ) -> Optional[float]: """ Important: Must be fetching data from cached values as this is used by backtesting! @@ -171,7 +171,7 @@ class Binance(Exchange): :param wallet_balance: Amount of margin_mode in the wallet being used to trade Cross-Margin Mode: crossWalletBalance Isolated-Margin Mode: isolatedWalletBalance - :param other_trades: List of other open trades in the same wallet + :param open_trades: List of open trades in the same wallet # * Only required for Cross :param mm_ex_1: (TMM) @@ -191,7 +191,7 @@ class Binance(Exchange): if self.margin_mode == MarginMode.CROSS: mm_ex_1: float = 0.0 upnl_ex_1: float = 0.0 - for trade in other_trades: + for trade in open_trades: mm_ratio1, maint_amnt1 = self.get_maintenance_ratio_and_amt( trade["pair"], trade["stake_amount"] ) diff --git a/freqtrade/exchange/bybit.py b/freqtrade/exchange/bybit.py index c14273e53..967c80b7d 100644 --- a/freqtrade/exchange/bybit.py +++ b/freqtrade/exchange/bybit.py @@ -147,7 +147,7 @@ class Bybit(Exchange): stake_amount: float, leverage: float, wallet_balance: float, # Or margin balance - other_trades: list, + open_trades: list, ) -> Optional[float]: """ Important: Must be fetching data from cached values as this is used by backtesting! @@ -177,7 +177,7 @@ class Bybit(Exchange): :param wallet_balance: Amount of margin_mode in the wallet being used to trade Cross-Margin Mode: crossWalletBalance Isolated-Margin Mode: isolatedWalletBalance - :param other_trades: List of other open trades in the same wallet + :param open_trades: List of other open trades in the same wallet """ market = self.markets[pair] diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index d6149745a..c0b4a72e9 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -3532,7 +3532,7 @@ class Exchange: stake_amount: float, leverage: float, wallet_balance: float, - other_trades: Optional[list] = None, + open_trades: Optional[list] = None, ) -> Optional[float]: """ Set's the margin mode on the exchange to cross or isolated for a specific pair @@ -3554,7 +3554,7 @@ class Exchange: leverage=leverage, stake_amount=stake_amount, wallet_balance=wallet_balance, - other_trades=other_trades or [], + open_trades=open_trades or [], ) else: positions = self.fetch_positions(pair) @@ -3580,7 +3580,7 @@ class Exchange: stake_amount: float, leverage: float, wallet_balance: float, # Or margin balance - other_trades: list, + open_trades: list, ) -> Optional[float]: """ Important: Must be fetching data from cached values as this is used by backtesting! @@ -3605,7 +3605,7 @@ class Exchange: :param wallet_balance: Amount of margin_mode in the wallet being used to trade Cross-Margin Mode: crossWalletBalance Isolated-Margin Mode: isolatedWalletBalance - :param other_trades: List of other open trades in the same wallet + :param open_trades: List of other open trades in the same wallet """ market = self.markets[pair] diff --git a/freqtrade/leverage/liquidation_price.py b/freqtrade/leverage/liquidation_price.py index e2fb167c8..027cd74a6 100644 --- a/freqtrade/leverage/liquidation_price.py +++ b/freqtrade/leverage/liquidation_price.py @@ -43,7 +43,7 @@ def update_liquidation_prices( stake_amount=t.stake_amount, leverage=trade.leverage, wallet_balance=total_wallet_stake, - other_trades=[tr for tr in open_trades if t.id != tr.id], + open_trades=[tr for tr in open_trades], ) ) elif trade: diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 7535822c3..35d0b18dd 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -6009,7 +6009,7 @@ def test_get_liquidation_price1(mocker, default_conf): stake_amount=18.884 * 0.8, leverage=leverage, wallet_balance=18.884 * 0.8, - other_trades=[], + open_trades=[], ) @@ -6140,7 +6140,7 @@ def test_get_liquidation_price( wallet_balance=amount * open_rate / leverage, leverage=leverage, is_short=is_short, - other_trades=[], + open_trades=[], ) if expected_liq is None: assert liq is None