コード例 #1
0
bitflyer_raws = []
zaif_raws = []
quoinex_raws = []
coincheck_raws = []
timestamp = []
start = time.time()
t = 3

#1分おきにt分間データを収集
while True:
    # 毎分00秒に稼働
    if datetime.now().strftime('%S')[0:2] == '00':
        # データの取得
        bitflyer_tick = bitflyerapi.ticker(product_code="BTC_JPY")
        print("{}".format(json.dumps(bitflyer_tick, indent=4)))
        zaif_last_price = zaifapi.last_price('btc_jpy')
        print("{}".format(json.dumps(zaif_last_price, indent=4)))
        Quoinex_Markets_BTCJPY = requests.get(
            'https://api.quoine.com/products/code/CASH//BTCJPY')
        quoinex_tick = json.loads(Quoinex_Markets_BTCJPY.text)
        print("{}".format(json.dumps(quoinex_tick, indent=4)))
        coincheck_tick = coinCheck.ticker.all()
        print(coincheck_tick)
        coincheck_tick_dic = ast.literal_eval(coincheck_tick)
        #データの更新
        bitflyer_raws = np.append(bitflyer_raws, bitflyer_tick['ltp'])
        zaif_raws = np.append(zaif_raws, zaif_last_price['last_price'])
        quoinex_raws = np.append(quoinex_raws,
                                 quoinex_tick['last_traded_price'])
        coincheck_raws = np.append(coincheck_raws, coincheck_tick_dic['last'])
        timestamp = np.append(timestamp, datetime.now())
コード例 #2
0
from zaifapi.impl import ZaifPublicApi
# 時間の管理に使う
import time
from datetime import datetime
#データのプロットに使う
import matplotlib
import matplotlib.pyplot as plt

#bitflyer
# bfapi = pybitflyer.API()
# bfticker = bfapi.ticker(product_code="BTC_JPY")
# print("{}".format(json.dumps(bfticker,indent=4)))

#zaif
zaif = ZaifPublicApi()
print(zaif.last_price('btc_jpy'))

# #coincheck

#quoinex
# GET /products/code/:code/:currency_pair_code
# Markets_BTCJPY = requests.get('https://api.quoine.com/products/code/CASH//BTCJPY')

# sirtmp = json.loads(Markets_BTCJPY.text)
# print("{}".format(json.dumps(sirtmp,indent=4)))

raws = []
timestamp = []
start = time.time()
t = 3