Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

updating websocket example for Future Pyhton SDK #35

Open
hedayat-bazafkan wants to merge 12 commits intomainfrom
new-api
Open

updating websocket example for Future Pyhton SDK #35
hedayat-bazafkan wants to merge 12 commits intomainfrom
new-api

Conversation

@hedayat-bazafkan
Copy link

@hedayat-bazafkan hedayat-bazafkan commented Jun 15, 2022

Example update for deprectaing endpoint

import asyncio
from kucoin_futures.client import WsToken
from kucoin_futures.ws_client import KucoinFuturesWsClient

async def main():
async def deal_msg(msg):
if msg['topic'] == '/contractMarket/level2:XBTUSDM':
print(f'Get XBTUSDM Ticker:{msg["data"]}')

# is public

client = WsToken(is_sandbox=True)
ws_client = await KucoinFuturesWsClient.create(loop, client, deal_msg, private=False)
await ws_client.subscribe('/contractMarket/level2:XBTUSDM')

while True:
    await asyncio.sleep(60)

if name == "main":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants