I have set up a read-only API key on Binance to access account information like currency balances but I can\'t see the JSON data. The string query I put into the URL returns th
Binance's websocket API kinda tricky to use. Also there is no way to use a secret key.
X-MBX-APIKEY
header to https://api.binance.com/api/v1/userDataStream {"listenKey": "your listen key here"}
wss://stream.binance.com:9443/ws/{your listen key here}
import ssl
from websocket import create_connection
import requests
KEY = 'your-secret-key'
url = 'https://api.binance.com/api/v1/userDataStream'
listen_key = requests.post(url, headers={'X-MBX-APIKEY': KEY})['listenKey']
connection = create_connection('wss://stream.binance.com:9443/ws/{}'.format(KEY),
sslopt={'cert_reqs': ssl.CERT_NONE})