LoginSignup
3

More than 5 years have passed since last update.

Python - bitflyer 資産残高を取得

Posted at

pybitflyerインストール

pip install pybitflyer

API Document

ソース

import pybitflyer
import time
from datetime import datetime
from pytz import timezone
from dateutil import parser

BALANCE_KEYS = ["currency_code",
                "amount",
                "available"]

API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
API_SECRET = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"


if __name__ == '__main__':
    api = pybitflyer.API(api_key = API_KEY, api_secret = API_SECRET)

    balances = api.getbalance(product_code="BTC_JPY")

    for balance in balances:
        for balance_key in BALANCE_KEYS:
            print(balance_key + " : " + str(balance[balance_key]))
        print("=================================================")

結果

currency_code : JPY
amount : 2793972636.0
available : 2793972636.0
=================================================
currency_code : BTC
amount : 600.2235
available : 600.2235
=================================================
currency_code : BCH
amount : 600.0685
available : 600.0685
=================================================
currency_code : ETH
amount : 0.0
available : 0.0
=================================================
currency_code : ETC
amount : 0.0
available : 0.0
=================================================
currency_code : LTC
amount : 0.0
available : 0.0
=================================================

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3