Connect to coincheck's Websocket API from Python

Coincheck's WebSocket API

wss://ws-api.coincheck.com/

environment

Python 3.6.0 |Anaconda 4.3.0 (64-bit)

websocket-client (0.40.0)

If not, pip install websocket-client

Connection (transaction history)

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())

Connection (board)

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())

I thought that it wouldn't come back even if I connected, but there was no transaction ()

Recommended Posts

Connect to coincheck's Websocket API from Python
Connect to utf8mb4 database from python
API explanation to touch mastodon from python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Connect python to mysql
Use Tor to connect from urllib2 [Python] [Mac]
Connect to BigQuery with Python
Post from Python to Slack
Cheating from PHP to Python
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Switch from python2.7 to python3.6 (centos7)
Use e-Stat API from Python
I tried to create API list.csv in Python from swagger.yaml
How to connect to various DBs from Python (PEP 249) and SQLAlchemy
Call Matlab from Python to optimize
Create folders from '01' to '12' with python
Post from python to facebook timeline
[Lambda] [Python] Post to Twitter from Lambda!
Python (from first time to execution)
Use kabu StationĀ® API from Python
Post images from Python to Tumblr
How to use OpenPose's Python API
Use the Flickr API from Python
Get upcoming weather from python weather api
Ssh connect to GCP from Windows
How to access wikipedia from python
Python to switch from another language
Run Ansible from Python using API
[Python] How to use Typetalk API
Use Google Analytics API from Python
Handle SOAP API from Python (Zeep)
Did not change from Python 2 to 3
Update Python on Mac from 2 to 3
How to get followers and followers from python using the Mastodon API
How to connect to Cloud Firestore from Google Cloud Functions with python code
Make a request from Device Farm (appium python) to API Gateway
Collecting information from Twitter with Python (Twitter API)
[Python] Web application from 0! Hands-on (3) -API implementation-
Connect to Packetix VPN from CentOS 7 minimal.
[Python] Fluid simulation: From linear to non-linear
Connect to Docker's MySQL container from Flask
From Python to using MeCab (and CaboCha)
Python: Reading JSON data from web API
How to update Google Sheets from Python
Send a message from Python to Slack
Private Python handbook (updated from time to time)
I want to use jar from python
Connect to MySQL with Python within Docker
Convert from katakana to vowel kana [python]
Push notification from Python server to Android
Connecting from python to MySQL on CentOS 6.4
Use Google Cloud Vision API from Python
I tried using UnityCloudBuild API from Python
Porting and modifying doublet-solver from python2 to python3.
How to access RDS from Lambda (python)
Python> Output numbers from 1 to 100, 501 to 600> For csv
Connect to s3 with AWS Lambda Python
[Python / Tkinter] Connect keyboard shortcuts to Menu
Connect to pepper with PEPPER Mac's python interpreter
Convert from Markdown to HTML in Python