Easily display bitflyer board information

Motivation

Know the easiest price to execute when ordering from bitflyer lightning at limit price

Code

Board information acquisition.ipynb


import requests
import json 
import matplotlib.pyplot as plt
%matplotlib inline

baseurl = "https://api.bitflyer.jp"
pathurl = "/v1/board"
params = "?product_code=FX_BTC_JPY"
url = baseurl +  pathurl + params

response = requests.get(url).json()
#ASKS
sizes = []
prices = []
for res in response['asks']:
    sizes.append(res['size'])
    prices.append(res['price'])

print("MIN ASKS:" + str(min(prices)))
plt.plot(sizes,prices,color="red",alpha=0.3)

#BIDS
sizes = []
prices = []
for res in response['bids']:
    sizes.append(res['size'])
    prices.append(res['price'])

print("MAX BIDS:" + str(max(prices)))
plt.plot(sizes,prices,color="green",alpha=0.3)

plt.savefig('figure.png')

result

MIN ASKS:898966.0 MAX BIDS:898942.0 figure.png → You can see that you should place a limit order between 898966.0 and 898942.0

Recommended Posts

Easily display bitflyer board information
Easy display of binance board information (could not)
Get BTC / JPY board information from Python --bitflyer