coincheckのWebSocketAPI
wss://ws-api.coincheck.com/
環境
Python 3.6.0 |Anaconda 4.3.0 (64-bit)
websocket-client (0.40.0)
入ってなければ pip install websocket-client
接続(取引履歴)
import json
from websocket import create_connection
ws = create_connection("wss://ws-api.coincheck.com/")
ws.send(json.dumps({
"type": "subscribe",
"channel": "btc_jpy-trades"
}))
while True:
print (ws.recv())
接続(板)
import json
from websocket import create_connection
ws = create_connection("wss://ws-api.coincheck.com/")
ws.send(json.dumps({
"type": "subscribe",
"channel": "btc_jpy-orderbook"
}))
while True:
print (ws.recv())
接続しても返ってこないなーと思っていたら取引が無かっただけでした()