diff --git a/binance/async_client.py b/binance/async_client.py index a7503f56..d0efec2b 100644 --- a/binance/async_client.py +++ b/binance/async_client.py @@ -629,9 +629,11 @@ async def order_limit(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params): order_limit.__doc__ = Client.order_limit.__doc__ async def order_limit_buy(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params): - params.update({ - "side": self.SIDE_BUY, - }) + params.update( + { + "side": self.SIDE_BUY, + } + ) return await self.order_limit(timeInForce=timeInForce, **params) order_limit_buy.__doc__ = Client.order_limit_buy.__doc__ @@ -710,7 +712,7 @@ async def get_account(self, **params): get_account.__doc__ = Client.get_account.__doc__ - async def get_asset_balance(self, asset = None, **params): + async def get_asset_balance(self, asset=None, **params): res = await self.get_account(**params) # find asset balance in list of balances if "balances" in res: @@ -3263,10 +3265,12 @@ async def ws_order_limit(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **param :returns: WS response See order endpoint for full response options """ - params.update({ - "type": self.ORDER_TYPE_LIMIT, - "timeInForce": timeInForce, - }) + params.update( + { + "type": self.ORDER_TYPE_LIMIT, + "timeInForce": timeInForce, + } + ) return await self.ws_create_order(**params) async def ws_order_limit_buy( @@ -3295,9 +3299,11 @@ async def ws_order_limit_buy( :returns: WS response See order endpoint for full response options """ - params.update({ - "side": self.SIDE_BUY, - }) + params.update( + { + "side": self.SIDE_BUY, + } + ) return await self.ws_order_limit(timeInForce=timeInForce, **params) async def ws_order_limit_sell( diff --git a/binance/client.py b/binance/client.py index c5641e5d..96a2a947 100755 --- a/binance/client.py +++ b/binance/client.py @@ -1359,9 +1359,11 @@ def order_limit_buy(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params): :raises: BinanceRequestException, BinanceAPIException, BinanceOrderException, BinanceOrderMinAmountException, BinanceOrderMinPriceException, BinanceOrderMinTotalException, BinanceOrderUnknownSymbolException, BinanceOrderInactiveSymbolException """ - params.update({ - "side": self.SIDE_BUY, - }) + params.update( + { + "side": self.SIDE_BUY, + } + ) return self.order_limit(timeInForce=timeInForce, **params) def order_limit_sell(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params): @@ -1997,7 +1999,7 @@ def get_account(self, **params): """ return self._get("account", True, data=params) - def get_asset_balance(self, asset = None, **params): + def get_asset_balance(self, asset=None, **params): """Get current asset balance. :param asset: optional - the asset to get the balance of @@ -10201,10 +10203,12 @@ def ws_order_limit(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params): :returns: WS response See order endpoint for full response options """ - params.update({ - "type": self.ORDER_TYPE_LIMIT, - "timeInForce": timeInForce, - }) + params.update( + { + "type": self.ORDER_TYPE_LIMIT, + "timeInForce": timeInForce, + } + ) return self.ws_create_order(**params) def ws_order_limit_buy(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params): @@ -10231,9 +10235,11 @@ def ws_order_limit_buy(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params) :returns: WS response See order endpoint for full response options """ - params.update({ - "side": self.SIDE_BUY, - }) + params.update( + { + "side": self.SIDE_BUY, + } + ) return self.ws_order_limit(timeInForce=timeInForce, **params) def ws_order_limit_sell(self, timeInForce=BaseClient.TIME_IN_FORCE_GTC, **params): diff --git a/binance/exceptions.py b/binance/exceptions.py index 44753f56..62fcefb9 100644 --- a/binance/exceptions.py +++ b/binance/exceptions.py @@ -79,4 +79,5 @@ def __init__(self, value): super().__init__(message) -class UnknownDateFormat(Exception): ... +class UnknownDateFormat(Exception): + ... diff --git a/binance/ws/reconnecting_websocket.py b/binance/ws/reconnecting_websocket.py index f53cd717..b0bfdba1 100644 --- a/binance/ws/reconnecting_websocket.py +++ b/binance/ws/reconnecting_websocket.py @@ -149,10 +149,12 @@ async def _read_loop(self): self._log.debug( f"Queue overflow {self.MAX_QUEUE_SIZE}. Message not filled" ) - await self._queue.put({ - "e": "error", - "m": "Queue overflow. Message not filled", - }) + await self._queue.put( + { + "e": "error", + "m": "Queue overflow. Message not filled", + } + ) raise BinanceWebsocketUnableToConnect except asyncio.TimeoutError: self._log.debug(f"no message in {self.TIMEOUT} seconds") diff --git a/binance/ws/threaded_stream.py b/binance/ws/threaded_stream.py index e2fc575f..a0115a1b 100755 --- a/binance/ws/threaded_stream.py +++ b/binance/ws/threaded_stream.py @@ -32,7 +32,8 @@ def __init__( "session_params": session_params, } - async def _before_socket_listener_start(self): ... + async def _before_socket_listener_start(self): + ... async def socket_listener(self): self._client = await AsyncClient.create(loop=self._loop, **self._client_params) diff --git a/tests/test_async_client.py b/tests/test_async_client.py index 93fa4f03..d7c32fb3 100644 --- a/tests/test_async_client.py +++ b/tests/test_async_client.py @@ -84,6 +84,7 @@ async def test_get_asset_balance(clientAsync): async def test_get_asset_balance_no_asset_provided(clientAsync): await clientAsync.get_asset_balance() + async def test_get_my_trades(clientAsync): await clientAsync.get_my_trades(symbol="BTCUSDT") diff --git a/tests/test_client.py b/tests/test_client.py index fd10fe74..281060ec 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -82,6 +82,7 @@ def test_get_asset_balance(client): def test_get_asset_balance_no_asset_provided(client): client.get_asset_balance() + def test_get_my_trades(client): client.get_my_trades(symbol="BTCUSDT") diff --git a/tests/test_cryptography.py b/tests/test_cryptography.py index 8048fda3..04240262 100644 --- a/tests/test_cryptography.py +++ b/tests/test_cryptography.py @@ -47,6 +47,6 @@ def test_encryption(): ping=False, ) signature = client._generate_signature(data) - assert signature == case["expected_signature"], ( - f"Test failed: {case['description']}" - ) + assert ( + signature == case["expected_signature"] + ), f"Test failed: {case['description']}"