Git Product home page Git Product logo

python-bitbankcc's Introduction

python_bitbankcc

このライブラリは https://bitbank.cc/ の Public & Private API をパイソンで扱うためのものです。

インストール

# `@<commit_hash>` で現在のmasterに固定し、インストールすることをオススメします
# bash コメントを意味する # の前に \ でエスケープすること
sudo pip install git+https://github.com/bitbankinc/python-bitbankcc@<commit_hash>\#egg=python-bitbankcc

requirements.txt 利用

...
git+https://github.com/bitbankinc/python-bitbankcc@<commit_hash>#egg=python-bitbankcc
...

パラメーターの詳細

APIドキュメントをご覧いただき、各パラメータについてお読みになって下さい。

https://docs.bitbank.cc/

使い方

インポートする (インストールと違ってモジュール名は - ではなく _ になります)

import python_bitbankcc

パブリックAPI

import json

# public API classのオブジェクトを取得
pub = python_bitbankcc.public()

# PUBLIC TEST

value = pub.get_ticker(
    'btc_jpy' # ペア
)
print(json.dumps(value))

value = pub.get_depth(
    'btc_jpy' # ペア
)
print(json.dumps(value))

value = pub.get_transactions(
    'btc_jpy' # ペア
)
print(json.dumps(value))

# 同じメソッドを日にち指定で
value = pub.get_transactions(
    'btc_jpy', # ペア
    '20170313' # YYYYMMDD 型の日付
)
print(json.dumps(value))

value = pub.get_candlestick(
    'btc_jpy', # ペア
    '1hour', # タイプ
    '20170313' # YYYYMMDD 型の日付
)
print(json.dumps(value))

プライベートAPI

import os, json

API_KEY = os.environ['BITBANK_API_KEY']
API_SECRET = os.environ['BITBANK_API_SECRET']

prv = python_bitbankcc.private(API_KEY, API_SECRET)

# PRIVATE TEST

value = prv.get_asset()
print(json.dumps(value))

value = prv.get_order(
    'btc_jpy', # ペア
    '71084903' # 注文ID
)
print(json.dumps(value))

value = prv.get_active_orders(
    'btc_jpy' # ペア
)
print(json.dumps(value))

value = prv.order(
    'btc_jpy', # ペア
    '131594', # 価格 (成行注文の場合は None にする)
    '0.0001', # 注文枚数
    'buy', # 注文サイド (buy|sell)
    'limit', # 注文タイプ (limit|market|stop|stop_limit)
    # 以降は任意の引数
    False, # post_only 注文、デフォは False, None も可能で Falseと同じ挙動
    '151594' # trigger_price 逆指値などのトリガー価格
)
print(json.dumps(value))

value = prv.cancel_order(
    'btc_jpy', # ペア
    '133493980' # 注文ID
)
print(json.dumps(value))

value = prv.cancel_orders(
    'btc_jpy', # ペア
    ['133503762', '133503949'] # 注文IDのリスト
)
print(json.dumps(value))

value = prv.get_orders_info(
    'btc_jpy', # ペア
    ['133511828', '133511986'] # 注文IDのリスト
)
print(json.dumps(value))

value = prv.get_trade_history(
    'btc_jpy', # ペア
    '10' # 取得する約定数
)

value = prv.get_withdraw_account(
    'btc' # アセットタイプ
)
print(json.dumps(value))

value = prv.request_withdraw(
    'btc', # アセットタイプ
    'e9fb5d9f-0509-4cb5-8325-ec13ade4354c', # 引き出し先UUID
    '10.123', # 引き出し数
    { # 有効になっていた場合に必須
        'otp_token': '387427',
        'sms_token': '836827'
    }
)
print(json.dumps(value))

python-bitbankcc's People

Contributors

junderw avatar cjna avatar seii-saintway avatar pistatium avatar ikarishinjigao avatar koiizuka avatar kusano avatar leylinel2 avatar mojamonja avatar paulfjacobs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.