You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
ConnectionClosedError (received 1003 (unsupported data) binary frames are not supported; then sent 1003 (unsupported data) binary frames are not supported)
BinanceWebsocketClosed (Connection closed. Reconnecting...)
Traceback (most recent call last):
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\tasks.py", line 507, in wait_for
return await fut
^^^^^^^^^
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\ws\websocket_api.py", line 107, in request
response = await asyncio.wait_for(future, timeout=self.TIMEOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\tasks.py", line 506, in wait_for
async with timeouts.timeout(timeout):
~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\timeouts.py", line 116, in aexit
raise TimeoutError from exc_val
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\pythonProject3\silsonra.py", line 28, in
main()
~~~~^^
File "F:\pythonProject3\silsonra.py", line 19, in main
order = client.ws_create_order(
symbol="LTCUSDT",
...<2 lines>...
quantity=0.1,
)
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\client.py", line 10788, in ws_create_order
return self._ws_api_request_sync("order.place", True, params)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\base_client.py", line 413, in _ws_api_request_sync
return self.loop.run_until_complete(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self._ws_api_request(method, signed, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 720, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\base_client.py", line 408, in _ws_api_request
return await self.ws_api.request(id, payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\ws\websocket_api.py", line 116, in request
raise BinanceWebsocketUnableToConnect("Request timed out")
binance.exceptions.BinanceWebsocketUnableToConnect: Request timed out
Is this code works?
Describe the bug
ConnectionClosedError (received 1003 (unsupported data) binary frames are not supported; then sent 1003 (unsupported data) binary frames are not supported)
BinanceWebsocketClosed (Connection closed. Reconnecting...)
Traceback (most recent call last):
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\tasks.py", line 507, in wait_for
return await fut
^^^^^^^^^
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\ws\websocket_api.py", line 107, in request
response = await asyncio.wait_for(future, timeout=self.TIMEOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\tasks.py", line 506, in wait_for
async with timeouts.timeout(timeout):
~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\timeouts.py", line 116, in aexit
raise TimeoutError from exc_val
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\pythonProject3\silsonra.py", line 28, in
main()
~~~~^^
File "F:\pythonProject3\silsonra.py", line 19, in main
order = client.ws_create_order(
symbol="LTCUSDT",
...<2 lines>...
quantity=0.1,
)
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\client.py", line 10788, in ws_create_order
return self._ws_api_request_sync("order.place", True, params)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\base_client.py", line 413, in _ws_api_request_sync
return self.loop.run_until_complete(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self._ws_api_request(method, signed, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 720, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\base_client.py", line 408, in _ws_api_request
return await self.ws_api.request(id, payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ersint\AppData\Local\Programs\Python\Python313\Lib\site-packages\binance\ws\websocket_api.py", line 116, in request
raise BinanceWebsocketUnableToConnect("Request timed out")
binance.exceptions.BinanceWebsocketUnableToConnect: Request timed out
To Reproduce
import os
import sys
import asyncio
root = os.path.dirname(os.path.dirname(os.path.abspath(file)))
sys.path.append(root)
from binance import AsyncClient
create order using websockets async
the API is very similar to the REST API
async def main():
api_key = "" # your api_key here
secret = "" # your secret here
client = AsyncClient(api_key, secret, testnet=True)
order = await client.ws_create_order(
symbol="LTCUSDT",
side="BUY",
type="MARKET",
quantity=0.1,
)
print(order["orderId"])
await client.close_connection()
asyncio.run(main())
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: