bitflyer websocket 受信したが

wsを受信して、priceだけを取り出すコード

#pip install websocket-client
import websocket
import json
from pprint import pprint
import pandas as pd
CHANNEL = "lightning_executions_FX_BTC_JPY"

def on_message(ws, message):
    message = json.loads(message)
    #pprint(message)
    if message["method"] == "channelMessage":
        print("{}".format(int(message["params"]["message"][0]["price"])))
        

def on_open(ws):
    ws.send(json.dumps({"method": "subscribe",
                        "params": {"channel": CHANNEL}}))


if __name__ == "__main__":
    # note: reconnection handling needed.
    ws = websocket.WebSocketApp("wss://ws.lightstream.bitflyer.com/json-rpc",
                                on_message=on_message, on_open=on_open)
    ws.run_forever()

シンプル

976028
976088
976094
976108
976103
976143
976092
976073
976106
976109
976109
976116
976106
976057
976024
976024
976024
976014
976014
976014
976073