From 277761e60424e86256adc5e2853e2fc3caee8a6e Mon Sep 17 00:00:00 2001 From: Lennart Date: Sat, 30 Dec 2023 12:15:32 +0100 Subject: [PATCH 1/2] add get_ticker for rolling windows of different size From e092d16b0335735a22fede1c19029a5e7fb5e9bd Mon Sep 17 00:00:00 2001 From: carlosmiei <43336371+carlosmiei@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:31:32 +0100 Subject: [PATCH 2/2] feat(client): add get_symbol_ticker_window --- binance/client.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/binance/client.py b/binance/client.py index c15960e8..6339ebdd 100755 --- a/binance/client.py +++ b/binance/client.py @@ -1280,6 +1280,45 @@ def get_symbol_ticker(self, **params): """ return self._get('ticker/price', data=params, version=self.PRIVATE_API_VERSION) + + def get_symbol_ticker_window(self, **params): + """Latest price for a symbol or symbols. + + https://binance-docs.github.io/apidocs/spot/en/#rolling-window-price-change-statistics + + :param symbol: + :type symbol: str + + :returns: API response + + .. code-block:: python + + { + "symbol": "LTCBTC", + "price": "4.00000200" + } + + OR + + .. code-block:: python + + [ + { + "symbol": "LTCBTC", + "price": "4.00000200" + }, + { + "symbol": "ETHBTC", + "price": "0.07946600" + } + ] + + :raises: BinanceRequestException, BinanceAPIException + + """ + return self._get('ticker', data=params, version=self.PRIVATE_API_VERSION) + + def get_orderbook_ticker(self, **params): """Latest price for a symbol or symbols. @@ -8551,6 +8590,10 @@ async def get_symbol_ticker(self, **params): return await self._get('ticker/price', data=params, version=self.PRIVATE_API_VERSION) get_symbol_ticker.__doc__ = Client.get_symbol_ticker.__doc__ + async def get_symbol_ticker_window(self, **params): + return await self._get('ticker', data=params, version=self.PRIVATE_API_VERSION) + get_symbol_ticker_window.__doc__ = Client.get_symbol_ticker_window.__doc__ + async def get_orderbook_ticker(self, **params): return await self._get('ticker/bookTicker', data=params, version=self.PRIVATE_API_VERSION) get_orderbook_ticker.__doc__ = Client.get_orderbook_ticker.__doc__