Open Rilin opened 9 months ago
Tell me how to get balance and pos, order data through a private channel using websocket. I place orders manually in the app, deals appear, but the callbacks are empty. What am I doing wrong?
from pymexc import futures def onOrder(message): # handle websocket message print('onOrder') print(message) def onPosition(message): # handle websocket message print('onPosition') print(message) def onAsset(message): # handle websocket message print('onAsset') print(message) SYM = "ETH_USDT" futures_client = futures.HTTP(api_key = my_secret_var.mexc_api_key, api_secret = my_secret_var.mexc_api_secret) ws_futures_client = futures.WebSocket(api_key = my_secret_var.mexc_api_key, api_secret = my_secret_var.mexc_api_secret, restart_on_error=True, trace_logging=True) ws_futures_client.order_stream(onOrder) ws_futures_client.asset_stream(onAsset) ws_futures_client.position_stream(onPosition) while True: # lastPrice = getLastPrice(SYM) # secho(f"{Now()} {SYM} price:{lastPrice['indexPrice']} time:{lastPrice['timestamp']} check sqltask", fg='magenta') sleep(1000)
my API key:
Tell me how to get balance and pos, order data through a private channel using websocket. I place orders manually in the app, deals appear, but the callbacks are empty. What am I doing wrong?
my API key: