liquidpy is the Python library for trading cryptocurrency with the Liquid by Quoine.
if you need detail information about Liquid's API, please see Liquid official API document
pip install git+https://github.com/mitsutoshi/liquidpy#egg=liquidpy
Create Liquid object. API_KEY and API_SECRET are required if you use private API.
from liquidpy.api import Liquid
liquid = Liquid(api_key='xxx', api_secret='xxx')
get_products
calls /products
.
products = liquid.get_products()
for p in products:
print(p['product_id'])
print(p['currency_pair_code'])
get_products
with product_id calls /products/{product_id}
.
p = liquid.get_products(product_id=5)
print(p['product_id']) # 5
print(p['currency_pair_code']) # BTCJPY
Private API reuqires to authenticate. If you call it without authentication, exception will be thrown.
get_accounts_balnace
calls /accounts/balance
.
accounts_balance = liquid.get_accounts_balnace()
for b in accounts_balance:
print(b['currency'])
print(b['balance'])
orders = liquid.get_orders()
for o in orders:
print(f"order_id: {o['id']}")
Create a market type order.
from liquidpy.api import SIDE_BUY
res = liquid.create_order(product_id=5, side=SIDE_BUY, quantity=0.01)
print(f"order_id: {res['id']}")
Create a limit type order.
from liquidpy.api import SIDE_BUY
res = liquid.create_order(product_id=5, side=SIDE_BUY, quantity=0.01, price=1000000)
print(f"order_id: {res['id']}")
Cancel an order of id=1234.
liquid.cancel_order(id=1234)
Tests are in ./tests
directory. Tests won't create new orders.
Run all tests.
pipenv run tests
Run all tests with verbose option.
pipenv run testsv