Python --bitflyer Get asset balance

pybitflyer installation

pip install pybitflyer

API Document

https://lightning.bitflyer.jp/docs?lang=ja&_ga=2.242195781.679665938.1503589602-1417182779.1500704462#資産残高を取得

Source

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("=================================================")

result

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
=================================================

Recommended Posts

Python --bitflyer Get asset balance
Python --bitflyer Get chat content
Get Suica balance in Python (using libpafe)
Get BTC / JPY board information from Python --bitflyer
[Python] Get environment variables
[Python] Get Qiita trends
[Python3] Get date diff
Get date in Python
Get date with python
Python --bitflyer Bitcoin trading
python get current time
Get YouTube Comments in Python
Get last month in python
Get Twitter timeline with python
Get Youtube data with python
Get Terminal size in Python
[Python] Get the previous month
Explicitly get EOF in python
Get thread ID with python
Get started with Python! ~ ② Grammar ~
[python] Get quotient and remainder
Get stock price with Python
Get Evernote notes in Python
python> Get substring> print serial [5:10] / print serial [5: -1]
Get home directory with python
Get keyboard events with python
IfcOpenShell python bindings get started
(Python) Get AWS billing amount
Get Alembic information with Python
Python> dictionary> get ()> optional value
Get Japanese synonyms in Python
Get Leap Motion data in Python.
Get started with Python! ~ ① Environment construction ~
Link to get started with python
Get data from Quandl in Python
Get reviews with python googlemap api
Get the complete bitflyer tick data
Get the desktop path in Python
Get the weather with Python requests
Get web screen capture with python
Get the weather with Python requests 2
[Python] Get economic data with DataReader
Get the script path in Python
How to get the Python version
How to get started with Python
[Small story] Get timestamp with Python
Get, post communication memo in Python
Get Qiita trends with Python scraping
Get upcoming weather from python weather api
Get the desktop path in Python
Get the host name in Python
Python Note: Get the current month
Python version to get unused ports
Get started with Python in Blender
Get weather information with Python & scraping