loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Python 変数レッスンのデモコード
import requests

bf = requests.get('https://api.bitflyer.jp/v1/ticker/?product_code=BTC_JPY')
bb = requests.get('https://www.btcbox.co.jp/api/v1/ticker/')

print('【国内主要取引所の現在のビットコイン価格】')
print('bitFlyer ' , bf.json()['ltp'] , '円/BTC')
print('BTCBOX ' , bb.json()['last'] , '円/BTC\n')

bf_e = bf.json()['ltp']
bb_e = bb.json()['last']
average_price = (bf_e + bb_e)/2

print('【国内取引所の平均価格】\n' , average_price , '円/BTC\n')

bf_v = bf.json()['volume']
bb_v = bb.json()['vol']
average_volume = (bf_v + bb_v)/2
print('【国内取引所の平均出来高】\n' , average_volume , 'BTC')