this code:
SOCKET="wss://stream.binance.com:9443/ws/bitusdt@kline_15m"
def on_open(ws):
print(" opend connection ")
def on_close(ws):
print(" closed connection ")
def on_message(ws,message):
print(" receive message ")
json_message=json.loads(message)
pprint.pprint(json_message)
candle=json_message['k']
is_closed=candle['x']
if is_closed:
close=float(candle['c'])
high=float(candle['h'])
low=float(candle['l'])
vol=float(candle['v'])
time=pd.to_datetime(candle['t'],unit='ms')
record={'high':high,'low':low,'volum':vol}
print(close)
print('------')
ws=websocket.WebSocketApp(SOCKET,on_open= on_open,on_close=on_close, on_message= on_message)
ws.run_forever()
the problem is in close function ,it requires other parameters as far as I understand
error is : ERROR:websocket:Handshake status 451 None - goodbye ERROR:websocket:error from callback <function on_close at 0x7f61b5e74f70>: on_close() takes 1 positional argument but 3 were given True