Beispiel #1
0
#Zaifにアクセスするのに使う
from zaifapi.impl import ZaifPublicApi
#coincheckにアクセスするのに使う
from coincheck.coincheck import CoinCheck
import logging
# 時間の管理に使う
import time
from datetime import datetime
#データのプロットに使う
import matplotlib
import matplotlib.pyplot as plt
#型変換に使う
import ast

bitflyerapi = pybitflyer.API()
zaifapi = ZaifPublicApi()
coinCheck = CoinCheck('ACCES_KEY', 'API_SECRET')

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':
        # データの取得
Beispiel #2
0
    def __init__(self):

        Zaif.private = ZaifTradeApi(Zaif_Key, Zaif_Secret)
        Zaif.public = ZaifPublicApi()
Beispiel #3
0
#! /usr/bin/env python3

import sys
import sqlite3
import datetime
from zaifapi.impl import ZaifPublicApi
from contextlib import closing
from getccutil import get_today

api = ZaifPublicApi()

cc = sys.argv[1]
todaystr = get_today()
dbname = "{}-{}.db".format(cc, todaystr)


def exist_entry(csr, tid):
    csr.execute("select tid from trades where tid = ?", (tid, ))
    return (len(csr.fetchall()) > 0)


def gen_table(csr, table):
    pairs_table = {}
    for row in csr.execute("select * from {};".format(table)):
        pairs_table[row[1]] = row[0]
    return (pairs_table)


with closing(sqlite3.connect(dbname)) as conn:
    csr = conn.cursor()
    pairs_table = gen_table(csr, "currency_pairs")
#Zaifにアクセスするのに使う
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
Beispiel #5
0
#変数、リスト
da = []
time_list = []  #時間
time_list_ref = []  #参照時間
price_list = []  #zaifのBTC価格
price_list2 = []  #bitflayerのBTC価格
swap_list = []  #取引指標(swap)
list = []  #各リストの一時保存用
bids_list = []  #板の怪情報
asks_list = []  #板の売り情報
zaif_key = ""  #zaifでの取引に必要なAPIキー
zaif_secret = ""  #zaifでの取引に必要なシークレットAPIキー
zaif_LevaTrade = ZaifLeverageTradeApi(zaif_key, zaif_secret)
zaif_future = ZaifFuturesPublicApi()
zaif = ZaifPublicApi()
bf_key = ""  #bitflayerでの取引に必要なAPIキー
bf_secret = ""  #bitflayerでの取引に必要なシークレットAPIキー
bfapi = pybitflyer.API(api_key=bf_key, api_secret=bf_secret)


class BarPlot():
    def __init__(self, parent=None):
        #取得データ描画のため、キャンバスとグラフを用意
        self.dpi = 100
        self.fig = Figure((14.4, 12), dpi=self.dpi)
        self.canvas = FigureCanvas(self.fig)  # pass a figure to the canvas
        self.canvas.setParent(parent)

        self.axes = self.fig.add_axes([0.04, 0.6, 0.52, 0.35])  #main chart
        self.axes2 = self.fig.add_axes([0.04, 0.06, 0.52, 0.23])  #swap chart