chatgpt에서 생성된 코드가 k-라인 데이터를 가져옵니다. import websocket
url = “wss://fstream.binance.com/ws”
def on_open(ws):
sub_msg = { “method”: “SUBSCRIBE”, “params”: [ “btcusd_perpetual@kline_1m” ], “id”: 1 } ws.send(json.dumps(sub_msg))
def on_message(ws, message):
print(message)
if name == “main”:
ws = websocket.WebSocketApp(url, on_open=on_open, on_message=on_message)
ws.run_forever()
실행 오류 Traceback (most recent call last): File “”, line 1246, in init_ctx File “”, line 1, in ModuleNotFoundError: No module named ‘websocket’
chtgpt는 이 오류가 websocket이라는 모듈이 Python 환경에서 누락되어 있기 때문이라고 말합니다. 당신은 pip 또는 conda와 같은 도구를 사용하여 모듈을 설치해야 합니다. 당신은 다음과 같은 명령어를 터미널에서 또는 명령줄에서 실행하여 모듈을 설치할 수 있습니다.
“이것이 바로 질문의 이유인가?