/quadriga

Python Client for QuadrigaCX

Primary LanguagePythonMIT LicenseMIT

Python Client for QuadrigaCX

https://travis-ci.org/joowani/quadriga.svg?branch=master Package version Python Versions Test Coverage Issues Open MIT License

Introduction

Quadriga is a Python client for QuadrigaCX, a Canadian cryptocurrency exchange platform. It wraps REST API v2 and facilitates the process of trading Bitcoin, Ethereum and Litecoin.

Requirements

  • Python 2.7.x, 3.4.x, 3.5.x or 3.6.x
  • QuadrigaCX API secret, API key and client ID

Installation

To install a stable version from PyPi:

~$ pip install quadriga

To install the latest version directly from GitHub:

~$ pip install -e git+git@github.com:joowani/quadriga.git@master#egg=quadriga

Note: sudo may be required depending on the environment.

Getting Started

Here are some usage examples:

from quadriga import QuadrigaClient

# Initialize the QuadrigaCX client
client = QuadrigaClient(
    api_key='api_key',
    api_secret='api_secret',
    client_id='client_id',
    default_book='btc_usd'
)

# Get the latest trading summary
client.get_summary()

# Get all public open orders
client.get_public_orders()

# Get recently completed public trades
client.get_public_trades()

# Get the user's open orders
client.get_orders()

# Get the user's completed trades
client.get_trades()

# Get the user's account balance
client.get_balance()

# Buy 10 bitcoins at the market price
client.buy_market_order(10)

# Buy 10 bitcoins at limit price of $1000 USD
client.buy_limit_order(10, 1000)

# Sell 20 bitcoins at the market price
client.sell_market_order(20)

# Sell 20 bitcoins at limit price of $1300 USD
client.sell_limit_order(20, 1300)

# Look up an order by its ID
client.lookup_order('order_id')

# Cancel an open order by its ID
client.cancel_order('order_id')

# Return the deposit address used for funding bitcoin
client.get_deposit_address('bitcoin')

# Return the deposit address used for funding ether
client.get_deposit_address('ether')

# Return the deposit address used for funding litecoin
client.get_deposit_address('litecoin')

# Withdraw 15 bitcoins from QuadrigaCX to the given address
client.withdraw('bitcoin', 15, 'my_bitcoin_withdrawal_address')

# Withdraw 20 ethers from QuadrigaCX to the given address
client.withdraw('ether', 20, 'my_ether_withdrawal_address')

# Withdraw 50 litecoins from QuadrigaCX to the given address
client.withdraw('litecoin', 50, 'my_litecoin_withdrawal_address')

Check out the full API documentation for more details!

Contributing

Please have a look at this page before submitting a pull request. Thanks!