From 4c09e0f7e65d1478841ae42682fda0f69b01dbf5 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Thu, 26 Dec 2024 22:00:45 +0100 Subject: [PATCH] [Binance] fix futures tickers fetch --- Trading/Exchange/binance/binance_exchange.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Trading/Exchange/binance/binance_exchange.py b/Trading/Exchange/binance/binance_exchange.py index 60cd8affb..a099d4345 100644 --- a/Trading/Exchange/binance/binance_exchange.py +++ b/Trading/Exchange/binance/binance_exchange.py @@ -243,6 +243,14 @@ async def get_symbol_leverage(self, symbol: str, **kwargs: dict): # leverage is in position return self.connector.adapter.adapt_leverage(await self.get_position(symbol)) + async def get_all_currencies_price_ticker(self, **kwargs: dict) -> typing.Optional[dict[str, dict]]: + if "subType" in kwargs or not self.exchange_manager.is_future: + return await super().get_all_currencies_price_ticker(**kwargs) + # futures with unspecified subType: fetch both linear and inverse tickers + linear_tickers = await super().get_all_currencies_price_ticker(subType=self.LINEAR_TYPE, **kwargs) + inverse_tickers = await super().get_all_currencies_price_ticker(subType=self.INVERSE_TYPE, **kwargs) + return {**linear_tickers, **inverse_tickers} + async def set_symbol_margin_type(self, symbol: str, isolated: bool, **kwargs: dict): """ Set the symbol margin type