Utiliser le client LiquidTap Python ①

table des matières

introduction

L'API de "Liquid by Quoine" est ouverte au public, je vais donc essayer différentes choses. Tout d'abord, à partir du service WebSocket.

Obtenez le "Carnet de commandes" pour "Liquid by Quoine"

Installez la bibliothèque et essayez d'obtenir BTC / JPY. (2020.01.22)

Installer la bibliothèque

$ pip3 install liquidtap

Ecrire le code en référence à l'exemple d'origine

Siège social: https://github.com/QuoineFinancial/liquid-tap-python

price.py


import liquidtap
import time

def update_callback_buy(data):
    print("buy:" + data)

def update_callback_sell(data):
    print("sell:" + data)

def on_connect(data):
    tap.pusher.subscribe("price_ladders_cash_btcjpy_buy").bind('updated', update_callback_buy)
    tap.pusher.subscribe("price_ladders_cash_btcjpy_sell").bind('updated', update_callback_sell)

if __name__ == "__main__":
    tap = liquidtap.Client()
    tap.pusher.connection.bind('pusher:connection_established', on_connect)
    tap.pusher.connect()

    while True: #boucle infinie
        time.sleep(1)

Courir

Si vous l'exécutez et que vous voyez acheter et vendre (dans de nombreuses lignes), vous réussissez.

$ python3 price.py
sell:[["948886.00000","0.01419278"],["948922.00000","0.02100000"],["948934.00000","0.00191306"],["948944.94000","0.00100000"],["948946.00000","0.03242956"],["948947.00000","0.03242988"],["948954.00000","0.00850000"],["948955.94000","0.03243954"],["948956.94000","0.01621739"],["948959.94000","0.03243965"],["948962.94000","0.02800000"],["948975.00000","0.00100000"],["948987.00000","0.00900000"],["948987.93700","0.03705000"],["948991.65500","0.07000000"],["948996.00000","0.02100000"],["949000.00000","2.00000000"],["949018.00000","0.01000000"],["949046.89124","0.01000000"],["949087.99999","0.06000000"],["949101.61000","0.00100000"],["949103.00000","0.04900000"],["949143.43000","0.25140000"],["949158.06000","1.32366279"],["949183.00000","0.04000000"],["949206.50000","0.01000000"],["949219.97000","0.00100000"],["949249.50000","0.07000000"],["949265.27000","0.01220000"],["949283.00000","0.15000000"],["949307.69000","0.00860000"],["949354.00000","0.38919067"],["949355.00000","0.22500000"],["949357.00000","4.00000000"],["949371.00000","0.01000000"],["949384.00000","0.01100000"],["949390.11000","0.03999999"],["949399.00000","0.04000000"],["949421.11000","0.03999999"],["949427.00000","0.01710000"]]
buy:[["948627.00000","0.03242956"],["948626.00000","0.03242988"],["948619.00000","0.04000000"],["948618.50000","0.00200000"],["948611.66000","0.03243954"],["948609.16000","0.03979000"],["948607.66000","0.01621955"],["948604.66000","0.01622010"],["948601.66000","0.00950000"],["948591.65500","0.07000000"],["948556.00000","0.03750000"],["948549.67000","0.01000000"],["948537.00001","0.01621739"],["948522.01000","0.01400000"],["948520.63000","0.00200000"],["948519.00001","0.03000000"],["948472.38000","0.01000000"],["948468.10000","0.10000000"],["948441.00000","0.02610000"],["948437.00000","0.04076885"],["948434.00000","0.00500000"],["948409.18000","0.00200000"],["948409.00000","0.06000000"],["948406.00000","0.03000000"],["948405.00000","0.01000000"],["948393.75000","0.02800000"],["948393.00000","0.02880000"],["948379.00000","0.02520000"],["948371.01000","0.13080000"],["948371.00000","0.03478991"],["948363.57077","0.00852120"],["948350.16098","0.00345380"],["948341.00000","0.50000013"],["948323.98000","0.17633721"],["948287.75000","0.00100000"],["948275.00000","0.09761507"],["948269.00000","0.01989854"],["948239.51000","0.01000000"],["948239.00000","0.20692222"],["948223.00000","0.15000000"]]
buy:[["948627.00000","0.03242956"],["948626.00000","0.03242988"],["948619.00000","0.04000000"],["948618.50000","0.00200000"],["948611.66000","0.03243954"],["948609.16000","0.03979000"],["948607.66000","0.01621955"],["948604.66000","0.01622010"],["948601.66000","0.00950000"],["948591.65500","0.07000000"],["948556.00000","0.03750000"],["948549.67000","0.01000000"],["948537.00001","0.01621739"],["948522.01000","0.01400000"],["948520.63000","0.00200000"],["948472.38000","0.01000000"],["948468.10000","0.10000000"],["948441.00000","0.02610000"],["948437.00000","0.04076885"],["948434.00000","0.00500000"],["948409.18000","0.00200000"],["948409.00000","0.06000000"],["948406.00000","0.03000000"],["948405.00000","0.01000000"],["948393.75000","0.02800000"],["948393.00000","0.02880000"],["948379.00000","0.02520000"],["948371.01000","0.13080000"],["948371.00000","0.03478991"],["948363.57077","0.00852120"],["948350.16098","0.00345380"],["948341.00000","0.50000013"],["948323.98000","0.17633721"],["948287.75000","0.00100000"],["948275.00000","0.09761507"],["948269.00000","0.01989854"],["948239.51000","0.01000000"],["948239.00000","0.20692222"],["948223.00000","0.15000000"],["948184.00000","0.22500000"]]
buy:[["948627.00000","0.03242956"],["948626.00000","0.03242988"],["948619.00000","0.04000000"],["948618.50000","0.00200000"],["948611.66000","0.03243954"],["948609.16000","0.03979000"],["948607.66000","0.01621955"],["948604.66000","0.01622010"],["948601.66000","0.00950000"],["948591.65500","0.07000000"],["948556.00000","0.03750000"],["948549.67000","0.01000000"],["948537.00001","0.01621739"],["948522.01000","0.01400000"],["948520.63000","0.00200000"],["948488.00001","0.03000000"],["948472.38000","0.01000000"],["948468.10000","0.10000000"],["948441.00000","0.02610000"],["948437.00000","0.04076885"],["948434.00000","0.00500000"],["948409.18000","0.00200000"],["948409.00000","0.06000000"],["948406.00000","0.03000000"],["948405.00000","0.01000000"],["948393.75000","0.02800000"],["948393.00000","0.02880000"],["948379.00000","0.02520000"],["948371.01000","0.13080000"],["948371.00000","0.03478991"],["948363.57077","0.00852120"],["948350.16098","0.00345380"],["948341.00000","0.50000013"],["948323.98000","0.17633721"],["948287.75000","0.00100000"],["948275.00000","0.09761507"],["948269.00000","0.01989854"],["948239.51000","0.01000000"],["948239.00000","0.20692222"],["948223.00000","0.15000000"]]
buy:[["948627.00000","0.03242956"],["948626.00000","0.03242988"],["948619.00000","0.04000000"],["948618.50000","0.00200000"],["948611.66000","0.03243954"],["948609.16000","0.03979000"],["948607.66000","0.01621955"],["948604.66000","0.01622010"],["948601.66000","0.00950000"],["948591.65500","0.07000000"],["948556.00000","0.03750000"],["948549.67000","0.01000000"],["948537.00001","0.01621739"],["948522.01000","0.01400000"],["948520.63000","0.00200000"],["948488.00001","0.03000000"],["948472.38000","0.01000000"],["948468.10000","0.10000000"],["948441.00000","0.02610000"],["948434.00000","0.00500000"],["948411.00000","0.04076885"],["948409.18000","0.00200000"],["948409.00000","0.06000000"],["948406.00000","0.03000000"],["948405.00000","0.01000000"],["948393.75000","0.02800000"],["948393.00000","0.02880000"],["948379.00000","0.02520000"],["948371.01000","0.13080000"],["948371.00000","0.03478991"],["948363.57077","0.00852120"],["948350.16098","0.00345380"],["948341.00000","0.50000013"],["948323.98000","0.17633721"],["948287.75000","0.00100000"],["948275.00000","0.09761507"],["948269.00000","0.01989854"],["948239.51000","0.01000000"],["948239.00000","0.20692222"],["948223.00000","0.15000000"]]

Il a été affiché en toute sécurité. C'est une boucle infinie, alors appuyez sur Ctrl + c pour l'arrêter. .. ..

Recommended Posts

Utiliser le client LiquidTap Python ③
Utiliser le client LiquidTap Python ②
Utiliser le client LiquidTap Python ①
Utilisez Thingsspeak de Python
Utilisez config.ini avec Python
[Python] Utiliser JSON avec Python
Utiliser fluentd de python
Configuration du client Python StatsD
Utiliser des dates en Python
Utilisez MySQL depuis Python
Utiliser mecab avec Python 3
Utiliser DynamoDB avec Python
Utilisez Python 3.8 avec Anaconda
Utilisation méthodique du format [Python]
Utiliser python avec docker
Utiliser MySQL depuis Python
Utilisez BigQuery depuis Python.
Utiliser le profileur en Python
Utilisez mecab-ipadic-neologd de Python
Voyons comment utiliser def en python
Utilisons Python Janome facilement
Utiliser l'API Trello avec python
Utiliser le protocole de mesure avec Python
python3: Comment utiliser la bouteille (2)
Utiliser la fonction de rappel en Python
Utiliser l'API Twitter avec Python
Utiliser le magasin de paramètres en Python
[Python] Utiliser une séquence de chaînes
[Python] Comment utiliser la liste 1
Python est douloureux. Mais utilisez
Utiliser le cache HTTP en Python
Utiliser TUN / TAP avec Python
Utiliser MySQL depuis Anaconda (python)
Utilisez l'ODM de MongoDB avec Python
Utiliser un dict clé de liste en Python
Comment utiliser Python Argparse
Utiliser Random Forest avec Python
Utilisez Spyder de Python IDE
Python: comment utiliser pydub
[Python] Comment utiliser checkio
Client IRC simple avec python
Utiliser Python sur Windows (PyCharm)
[Python] Comment utiliser input ()
Comment utiliser Python lambda
python3: Comment utiliser la bouteille
Comment utiliser les octets Python
Utilisez pymol comme bibliothèque python
Python: comment utiliser async avec
Utiliser la PNL Stanford Core à partir de Python
Utiliser la caméra Point Grey avec Python (PyCapture2)
Python
Utilisez le tissu tel quel en python (fabric3)
[Python] Comment utiliser la série Pandas
[Python / matplotlib] Comprendre et utiliser FuncAnimation
Comment utiliser les requêtes (bibliothèque Python)
Comment utiliser SQLite en Python
Comment utiliser correctement le package de visualisation Python
Créer une nouvelle application utiliser python, django
Utilisez NAIF SPICE TOOL KIT avec Python