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
Tried to run the basic example for a market subscription, but I am getting this error: /workspaces/ft_userdata/user_data/tradingbot/bot.py:16:`` DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop() INFO:client:Connecting to wss://stream.crypto.com/v2/market Traceback (most recent call last): File "/workspaces/ft_userdata/user_data/tradingbot/bot.py", line 17, in <module> loop.run_until_complete(run()) File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/workspaces/ft_userdata/user_data/tradingbot/bot.py", line 8, in run async with MarketClient() as client: File "/home/ftuser/.local/lib/python3.10/site-packages/crypto_com/crypto_com.py", line 65, in __aenter__ self.websocket = await websockets.connect(self.api_url) File "/home/ftuser/.local/lib/python3.10/site-packages/websockets/client.py", line 535, in __await_impl__ transport, protocol = await self._create_connection() File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection transport, protocol = await self._create_connection_transport( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1107, in _create_connection_transport protocol = protocol_factory() File "/home/ftuser/.local/lib/python3.10/site-packages/websockets/client.py", line 69, in __init__ super().__init__(**kwargs) File "/home/ftuser/.local/lib/python3.10/site-packages/websockets/protocol.py", line 235, in __init__ self._drain_lock = asyncio.Lock( File "/usr/local/lib/python3.10/asyncio/locks.py", line 78, in __init__ super().__init__(loop=loop) File "/usr/local/lib/python3.10/asyncio/mixins.py", line 17, in __init__ raise TypeError( TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
This is the code I am running with python 3.9:
`from crypto_com.crypto_com import MarketClient
import asyncio
import logging
logging.basicConfig(level=logging.INFO)
async def run():
async with MarketClient() as client:
await client.subscribe(["book.CRO_USDC.10"])
while True:
event = await client.next_event()
print(event)
if name == "main":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())`
The text was updated successfully, but these errors were encountered:
Probably it is due an old version of websockets library. You traceback points to /home/ftuser/.local/lib/python3.10/site-packages/websockets/protocol.py.
I'm not getting any issue but I upgraded to the latest websocket version anyway.
Tried to run the basic example for a market subscription, but I am getting this error:
/workspaces/ft_userdata/user_data/tradingbot/bot.py:16:`` DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop() INFO:client:Connecting to wss://stream.crypto.com/v2/market Traceback (most recent call last): File "/workspaces/ft_userdata/user_data/tradingbot/bot.py", line 17, in <module> loop.run_until_complete(run()) File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/workspaces/ft_userdata/user_data/tradingbot/bot.py", line 8, in run async with MarketClient() as client: File "/home/ftuser/.local/lib/python3.10/site-packages/crypto_com/crypto_com.py", line 65, in __aenter__ self.websocket = await websockets.connect(self.api_url) File "/home/ftuser/.local/lib/python3.10/site-packages/websockets/client.py", line 535, in __await_impl__ transport, protocol = await self._create_connection() File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection transport, protocol = await self._create_connection_transport( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1107, in _create_connection_transport protocol = protocol_factory() File "/home/ftuser/.local/lib/python3.10/site-packages/websockets/client.py", line 69, in __init__ super().__init__(**kwargs) File "/home/ftuser/.local/lib/python3.10/site-packages/websockets/protocol.py", line 235, in __init__ self._drain_lock = asyncio.Lock( File "/usr/local/lib/python3.10/asyncio/locks.py", line 78, in __init__ super().__init__(loop=loop) File "/usr/local/lib/python3.10/asyncio/mixins.py", line 17, in __init__ raise TypeError( TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
This is the code I am running with python 3.9:
`from crypto_com.crypto_com import MarketClient
import asyncio
import logging
logging.basicConfig(level=logging.INFO)
async def run():
async with MarketClient() as client:
await client.subscribe(["book.CRO_USDC.10"])
while True:
event = await client.next_event()
print(event)
if name == "main":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())`
The text was updated successfully, but these errors were encountered: