LiquidTap Python Clientを使う②
目次
はじめに
「Liquid by Quoine」のAPIを叩こう~その2~
「Liquid by Quoine」の"Orders"を取得する
BTC/JPYの発注とキャンセルを実行した結果を取得してみる。
(2020.02.07)
コードを書く
orders.py
import liquidtap
import time
def order_callback(data):
print("order:" + data)
if __name__ == "__main__":
token = "APIトークンID"
secret = "APIトークン秘密鍵"
tap = liquidtap.Client(token, secret)
tap.pusher.connect()
tap.subscribe("user_account_jpy_orders").bind('updated', order_callback)
while True: # 無限ループ
time.sleep(1)
実行
orders.pyを実行し、トレードツールから発注とキャンセルを実行してみます。
$ python3 orders.py
order:{"average_price":0.0,"client_order_id":null,"created_at":1581080779,"crypto_account_id":null,"currency_pair_code":"BTCJPY","disc_quantity":0.0,"filled_quantity":0.0,"funding_currency":"JPY","iceberg_total_quantity":0.0,"id":2079030430,"leverage_level":1,"margin_interest":0.0,"margin_type":null,"margin_used":0.0,"order_fee":0.0,"order_type":"limit","price":1500000.0,"product_code":"CASH","product_id":"5","quantity":0.001,"side":"sell","source_action":"manual","source_exchange":"QUOINE","status":"live","stop_loss":null,"take_profit":null,"target":"spot","trade_id":null,"trading_type":"spot","unwound_trade_id":null,"unwound_trade_leverage_level":null,"updated_at":1581080779}
order:{"average_price":0.0,"client_order_id":null,"created_at":1581080779,"crypto_account_id":null,"currency_pair_code":"BTCJPY","disc_quantity":0.0,"filled_quantity":0.0,"funding_currency":"JPY","iceberg_total_quantity":0.0,"id":2079030430,"leverage_level":1,"margin_interest":0.0,"margin_type":null,"margin_used":0.0,"order_fee":0.0,"order_type":"limit","price":1500000.0,"product_code":"CASH","product_id":"5","quantity":0.001,"side":"sell","source_action":"manual","source_exchange":"QUOINE","status":"cancelled","stop_loss":null,"take_profit":null,"target":"spot","trade_id":null,"trading_type":"spot","unwound_trade_id":null,"unwound_trade_leverage_level":null,"updated_at":1581080832}
表示された!
無限ループなので Ctrl+c で停止します。
Author And Source
この問題について(LiquidTap Python Clientを使う②), 我々は、より多くの情報をここで見つけました https://qiita.com/may-bee-39/items/a39b4e7c20cabb6f05de著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .