mexc-websocket added
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 1m12s

This commit is contained in:
dongho
2024-12-20 20:48:02 +09:00
parent 1b7cd7960e
commit 9e9cbf3547
6 changed files with 4419 additions and 0 deletions

25
mexc-socket.py Normal file
View File

@ -0,0 +1,25 @@
from pymexc import spot, futures
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("API_KEY")
api_secret = os.getenv("API_SECRET")
def handle_message(message):
print(message)
# initialize WebSocket client
ws_spot_client = spot.WebSocket(api_key = api_key, api_secret = api_secret)
# make http request to api
# create websocket connection to public channel (spot@public.deals.v3.api@BTCUSDT)
# all messages will be handled by function `handle_message`
ws_spot_client.deals_stream(handle_message, "BTCUSDT")
while True:
...