Python --bitflyer Bitcoin kaufen und verkaufen

Kaufen und verkaufen Sie Bitmünzen mit der Bitflyer-API

Pybitflyer installieren

pip install pybitflyer

API Key

Kann nach der Registrierung von den folgenden erhalten werden https://lightning.bitflyer.jp/developer

Quelle

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

Python --bitflyer Bitcoin kaufen und verkaufen
Python-Algorithmus Handelsbibliothek
Ich habe versucht, TradeWave zu verwenden (BitCoin-Systemhandel in Python)
Python --bitflyer Holen Sie sich das Guthaben
Python --bitflyer Chat-Inhalte abrufen
Python
Systemhandel ab Python3: langfristige Investition