Use LiquidTap Python Client ②

table of contents

Introduction

Let's hit the API of "Liquid by Quoine" -Part 2-

Get "Orders" for "Liquid by Quoine"

Try to get the result of executing BTC / JPY ordering and canceling. (2020.02.07)

Write code

orders.py


import liquidtap
import time

def order_callback(data):
    print("order:" + data)

if __name__ == "__main__":

    token = "API token ID"
    secret = "API token private key"

    tap = liquidtap.Client(token, secret)
    tap.pusher.connect()
    tap.subscribe("user_account_jpy_orders").bind('updated', order_callback)

    while True: #infinite loop
        time.sleep(1)

Run

Run orders.py and try ordering and canceling from the trading tool.

$ 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}

It was displayed! Since it is an infinite loop, press Ctrl + c to stop it.

This is what I ordered this time. order.png The image is small and it's Sumimasen.

Recommended Posts

Use LiquidTap Python Client ③
Use LiquidTap Python Client ②
Use LiquidTap Python Client ①
Use thingsspeak from python
Use config.ini in Python
[Python] Use JSON with Python
Use fluentd from python
Python StatsD client configuration
Use dates in Python
Use Valgrind in Python
Use MySQL from Python
Use mecab with Python3
Use DynamoDB with Python
Use Python 3.8 with Anaconda
[Python] format methodical use
Use MySQL from Python
Use BigQuery from python.
Use profiler in Python
Use mecab-ipadic-neologd from python
Let's use def in python
Let's use python janome easily
Use matplotlib on Ubuntu 12 & Python
Use let expression in Python
Use Measurement Protocol in Python
Use callback function in Python
Use Twitter API with Python
[Python] Use a string sequence
[Python] How to use list 1
Try using Kubernetes Client -Python-
Python is painful. But use
Use HTTP cache in Python
Use TUN / TAP with Python
Use MySQL from Anaconda (python)
Use MongoDB ODM in Python
Use list-keyed dict in Python
How to use Python argparse
Use Random Forest in Python
Use regular expressions in Python
Use Spyder in Python IDE
Python: How to use pydub
[Python] How to use checkio
Use subsonic API with python3
Simple IRC client in python
Use Python on Windows (PyCharm)
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
Use e-Stat API from Python
How to use Python bytes
Use pymol as a python library
Python: How to use async with
Use Stanford Core NLP from Python
Use vl53l0x with Raspberry Pi (python)
Python
Use fabric as is in python (fabric3)
[Python / matplotlib] Understand and use FuncAnimation
How to use Requests (Python Library)
How to use SQLite in Python
Proper use of Python visualization packages