How to use Websocket / Python


I want to query some markPrice symbols using Websocket, and I´d like to know if there is information about it using Python.


Orlando Gautier

Hello, I do not underestand your answer. Could you explain to me please.

Thank you!

sorry i posted something wrong , so i deleted it,
I request can you help me with my question?
Thank You

If I got it right, it’s about how to listen to websocket stream in python?


I´m connecting using:

from binance.client import Client

client = Client('xxxx', 'xxxx')

from binance.websockets import BinanceSocketManager

bm = BinanceSocketManager(client)

def process_m_message(msg):

print("stream: {} data: {}".format(msg['stream'], msg['data']))
conn_key = bm.start_multiplex_socket(['sxpusdt@aggTrade', 'sxpusdt@ticker','sxpusdt@markPrice'], process_m_message)


It works fine…

But when I try to get sxpusdt@markPrice or sxpusdt@markPrice@1s it does not work. I don´t know if it is neccesary to subuscribe to this work.


Orlando Gautier

Here is an example file with an other lib:

Thank you Dino,

markPrice is only from futures, it will return data if this bm can also handle futures streams.

sure, please post the question in a new topic. thank you