Getting event data from Websocket

Hi everyone,

I’m having trouble retrieving data from the websocket using the description given in the Python-API documentation https://python-binance.readthedocs.io/en/latest/websockets.html . I’ve written the code below. It executes, but does not produce any messages. I’d expect message events to appear in my jupyter notebook. What am I doing wrong?

Thanks in advance,
Florian

Import packages

from binance.client import Client
from binance.websockets import BinanceSocketManager
from twisted.internet import reactor

Set API keys

api_key = “”
api_secret = “”

print(‘Setting up the client’)
client = Client(api_key, api_secret)
client.API_URL = “https://testnet.binance.vision/api

def on_message(ws, message):
print(message)

Start the websocket manager

socketManager = BinanceSocketManager(client)

conn_key = socketManager.start_symbol_ticker_socket(‘BNBBUSD’, on_message)

Start the socket manager

print(‘Starting the socket manager’)
socketManager.start()

The SDK you use cannot get testnet wss properly. It would work if you remove this line:
client.API_URL = “https://testnet.binance.vision/api”