Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds ws client (threaded) #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0xfMissingNo
Copy link

In [1]: from dydx3 import Client

In [2]: from dydx3.constants import API_HOST_MAINNET

In [3]: cl = Client(API_HOST_MAINNET)

In [4]: cl.ws.start()

-- connection established --
In [5]: cl.ws.subscribe_to_orderbook('ETH-USD')

{"type":"channel_data","connection_id":"28f90048-272f-4af7-a0ff-2cb41a6e7085","message_id":2,"id":"ETH-USD","channel":"v3_orderbook","contents":{"offset":"1553537494","bids":[],"asks":[["3158.1","1.959"]]}}
{"type":"channel_data","connection_id":"28f90048-272f-4af7-a0ff-2cb41a6e7085","message_id":3,"id":"ETH-USD","channel":"v3_orderbook","contents":{"offset":"1553537498","bids":[["3140.4","82.289"],["3139.3","0.032"]],"asks":[]}}
{"type":"channel_data","connection_id":"28f90048-272f-4af7-a0ff-2cb41a6e7085","message_id":4,"id":"ETH-USD","channel":"v3_orderbook","contents":{"offset":"1553537505","bids":[],"asks":[["3159.2","0"]]}}
In [6]: cl.ws.stop()
{"type":"channel_data","connection_id":"28f90048-272f-4af7-a0ff-2cb41a6e7085","message_id":134,"id":"ETH-USD","channel":"v3_orderbook","contents":{"offset":"1553538703","bids":[],"asks":[["3156.8","6.336"]]}}
{"type":"channel_data","connection_id":"28f90048-272f-4af7-a0ff-2cb41a6e7085","message_id":135,"id":"ETH-USD","channel":"v3_orderbook","contents":{"offset":"1553538704","bids":[],"asks":[["3156.9","47.276"]]}}
{"type":"channel_data","connection_id":"28f90048-272f-4af7-a0ff-2cb41a6e7085","message_id":130,"id":"ETH-USD","channel":"v3_orderbook","contents":{"offset":"1553538662","bids":[["3156.6","0"]],"asks":[["3156.6","48.09"]]}}
-- connection closed --

@SC4RECOIN
Copy link

Tested this ws client on python 3.8 and it works great.
Thanks for the PR even though it looks like it's not getting merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants