Get BTC / JPY board information from Python --bitflyer

Get BTC / JPY board information from bitflyer

Source

import pybitflyer
import time
from datetime import datetime
from pytz import timezone
from dateutil import parser

BOARD_KEYS = ["asks",
              "bids",]

API_KEY = "XXXXXXXXXXXXXXXXXXXXXXX" #bitflyer Get from my page
API_SECRET = "XXXXXXXXXXXXXXXXXXXXXXX" #bitflyer Get from my page
       
def to_jst(datestr):
    return parser.parse(datestr).astimezone(timezone('Asia/Tokyo'))
       
if __name__ == '__main__':
    api = pybitflyer.API(api_key = API_KEY, api_secret = API_SECRET)
    
    board = api.board(product_code="BTC_JPY")
    
    for board_key in BOARD_KEYS:
        print(board_key + " : " + str(board[board_key][:5])) #Show only 5

result

asks : [{'size': 0.11494513, 'price': 444899.0}, {'size': 0.0418758, 'price': 444900.0}, {'size': 0.00975, 'price': 444998.0}, {'size': 0.94526412, 'price': 444999.0}, {'size': 10.1291162, 'price': 445000.0}]
bids : [{'size': 2.51806335, 'price': 444350.0}, {'size': 0.0035, 'price': 444300.0}, {'size': 0.496, 'price': 444274.0}, {'size': 0.01, 'price': 444100.0}, {'size': 0.01193694, 'price': 444000.0}]

Recommended Posts

Get BTC / JPY board information from Python --bitflyer
Python --Get bitcoin rate BTC / JPY from bitflyer at regular intervals and save it to a file
Python --bitflyer Get asset balance
Information obtained from tweet_id (Python)
Easily display bitflyer board information
Python --bitflyer Get chat content
Get Alembic information with Python
Get information such as GPU usage from Python (nvidia-smi command)
Get data from Quandl in Python
Get upcoming weather from python weather api
Get weather information with Python & scraping
[Python] Scraping lens information from Kakaku.com
Collecting information from Twitter with Python (Twitter API)
Get property information by scraping with python
Get html from element with Python selenium
Get exchange rates from open exchange rates in Python
[Note] Get data from PostgreSQL with Python
Get keystrokes from / dev / input (python evdev)
Get battery level from SwitchBot in Python
[Python] Get Python package information with PyPI API
Get Precipitation Probability from XML in Python
[Python] Get the main color from the screenshot
Get metric history from MLflow in Python
Visualize accelerometer information from the microcomputer board in real time with mbed + Python
Get time series data from k-db.com in Python
Collecting information from Twitter with Python (Environment construction)
Get note information using Evernote SDK for Python 3
Get information about videos uploaded to YouTube [Python]
[Python] Get one year's message history from Slack
Get only articles from web pages in Python
Python script to get note information with REAPER
sql from python
[Python] Get the text of the law from the e-GOV Law API
Collecting information from Twitter with Python (morphological analysis with MeCab)
Get schedule from Garoon SOAP API with Python + Zeep
Get data from GPS module at 10Hz in Python
Get the return code of the Python script from bat
Get mail from Gmail and label it with Python3
Get files from Linux using paramiko and scp [Python]
[Python] Get user information and article information with Qiita API
Python hand play (get column names from CSV file)
Get data from database via ODBC with Python (Access)