bitflyerの板情報を簡単に表示する
動機
bitflyer lightningに指値で注文する際に最も約定しやすい価格を知る
Code
板情報取得.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')
結果
板情報取得.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')
MIN ASKS:898966.0
MAX BIDS:898942.0
→898966.0〜898942.0の間で指値注文すればよいことがわかる
Author And Source
この問題について(bitflyerの板情報を簡単に表示する), 我々は、より多くの情報をここで見つけました https://qiita.com/nekonekocatman/items/4eb738024e5e4860c731著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .