pip install pybitflyer
API Key
Kann nach der Registrierung von den folgenden erhalten werden https://lightning.bitflyer.jp/developer
import pandas as pd
import pybitflyer
import time
from datetime import datetime
# size :Bestellmenge, Preis:Preis(Optional)
def buy(api, size, product_code = "BTC_JPY", child_order_type = "MARKET", price = None, minute_to_expire = 10000, time_in_force = "GTC"):
if price is None:
buy_btc = api.sendchildorder(product_code=product_code, child_order_type=child_order_type, side="BUY",size=size, minute_to_expire=minute_to_expire, time_in_force=time_in_force)
else:
buy_btc = api.sendchildorder(product_code=product_code, child_order_type=child_order_type, side="BUY",size=size, minute_to_expire=minute_to_expire, time_in_force=time_in_force, price=price)
# size :Bestellmenge, Preis:Preis(Optional)
def sell(api, size, product_code = "BTC_JPY", child_order_type = "MARKET", price = None, minute_to_expire = 10000, time_in_force = "GTC"):
if price is None:
sell_btc = api.sendchildorder(product_code=product_code, child_order_type=child_order_type, side="SELL",size=size, minute_to_expire=minute_to_expire, time_in_force=time_in_force)
else:
sell_btc = api.sendchildorder(product_code=product_code, child_order_type=child_order_type, side="SELL",size=size, minute_to_expire=minute_to_expire, time_in_force=time_in_force, price=price)
API_KEY = "XXXXXXXXXXXXXX"
API_SECRET = "XXXXXXXXXXXXXXXXXXXXXX"
if __name__ == '__main__':
api = pybitflyer.API(api_key = API_KEY, api_secret = API_SECRET)
# 0.Kaufen Sie 001 BTC
buy(api=api, size=0.001)
# 0.001 BTC Verkauf
sell(api=api, size=0.001)
Recommended Posts