xbt/cad XɃT/USD eth/xbt eth/cad ltc/cad bch/cad
  • Last trade: $8,349.00USD
  • Volume: 84.76722448XɃT
  • Low: $8,200.00USD
  • High: $8,390.00USD

Overview

The QuadrigaCX API allows you to integrate the QuadrigaCX trading platform with third party applications, such as trading applications, charting programs, point of sale systems, and much more. Below you will find details on how the system functions, along with examples in common programming languages.

QuadrigaCX notations

Major denotes any of the Cryptocurrencies such as Bitcoin (BTC), Litecoin (LTC) or any other cryptocurrency which is added to the QuadrigaCX trading platform in the future.

Minor denotes fiat currencies such as Canadian Dollars (CAD), US Dollars (USD), etc.

An order book is always referred to in the API as "Major_Minor". For example: "btc_cad"

The current order books on QuadrigaCX are:

  • btc_cad
  • btc_usd
  • eth_btc
  • eth_cad

*Note that Bitcoin is considered the "minor" currency in the Ether/Bitcoin order book.

The currencies are specified with the following 3 letter codes

  • Canadian Dollars = cad
  • US Dollars = usd
  • Bitcoin = btc
  • Ether = eth

Public API

Current Trading Information

GET https://api.quadrigacx.com/public/info

The above url will return trading a full list of trading information from all active order books within the QuadrigaCX system.

Result

A list of all the trading books with the following data:

  • rate - Last trade rate
  • volume – 24 hours rolling volume of that major currency
  • sell – Current Sell rate
  • buy – Current Buy rate

Recent Trades

GET https://api.quadrigacx.com/public/trades?book=XXX

The list of recent trades for the specified book – eg btc_cad

Result

An array of JSON objects containing the fields:

  • datetime – unix timestamp in milliseconds
  • amount – the amount of Major being traded
  • rate – the Minor rate used for the transaction
  • value – the real value in Minor currency

Open Orders

GET https://api.quadrigacx.com/public/orders?book=XXX

List of all sell open orders for the specified book – eg btc_cad

Result

An array of JSON objects containing the fields:

  • amount – the amount of Major being traded
  • rate – the Minor rate used for the transaction
  • value – the real value in Minor currency

API Authentication

Setup

To setup an API within your account, click on your username in the top right hand corner of the screen, and select "API Setup" from the drop down menu.

When setting up a new API, you will need to choose an API Name to identify your API. This name will never be shown anywhere apart from on your API Index page within your account. In addition to the name, an API Secret must be chosen. The field is pre-populated with a random number of characters, but can be changed at your discretion. Finally, you have the option of adding a Withdrawal Bitcoin Address, which can be used to lock the API Withdrawal function to a specific Bitcoin address of your choosing. This field is optional.

On the API setup page, you will be able to create a new API configuration. Once you have created a new API configuration, you will be given an "API Key" and an "API Secret". Make a note of these two fields, as they will be used for authentication when communicating with our server.

Make a note of these 2 fields as they are needed to authenticate you on the server when making requests to the private APIs. To generate a new API Secret, click on the icon next to the current secret. Note that this will instantly change the key, and cannot be undone.

Authentication

You need to POST 3 fields as a JSON payload to the API in order to perform authentication.

  • key – The API Key as shown above
  • nonce – an integer that must be unique for each API call (we recommend using a UNIX timestamp)
  • signature – HMAC_SHA256 encrypted string

Signature

The signature has to be created using a concatenation of the nonce, the API key, your client id and using the API Secret as key. The pseudo-algorithm is shown below and you will find code examples in the Appendix.

HMAC_SHA256 ( nonce + key + client , secret )

Please note the HMAC_SHA256 should be lower case.

Using the API shown in Figure 2, the JSON payload will be:

{
    key: "JJHlXeDcFM",
    nonce: 1391683499,
    signature: "f02bab8285cf2478fe585971020c7e89f3a11c40314ed5045b7a4ea45ab5bd3e"
}

The signature is calculated using:

HMAC_SHA256 ( 1391683499 + UUaGqlbwsc + 3 , 230664ae53cbe5a07c6c389910540729 )
HMAC_SHA256 ( 1391683499UUaGqlbwsc3 , 230664ae53cbe5a07c6c389910540729 )
= f02bab8285cf2478fe585971020c7e89f3a11c40314ed5045b7a4ea45ab5bd3e

Private API

Account balance

POST https://api.quadrigacx.com/private/balances

Payload

  • Authentication

Result

A JSON object will be returned containing all the balances you have on the site, including the available and locked for orders amount.

Open Orders

POST https://api.quadrigacx.com/private/orders

Payload

  • Authentication
  • Optional book (eg btc_cad) – if not specified, all open orders will be sent

Result

An array of JSON objects per book will be sent. Each order object will be of the structure:

  • id – a 64 characters long hexadecimal string representing the order
  • type – whether this order is a sell or a buy
  • amount – the amount of Major currency represented
  • rate – the amount of minor currency
  • value – the order value in minor currency

Cancel Order

POST https://api.quadrigacx.com/private/cancel

Payload

  • Authentication
  • id – a 64 characters long hexadecimal string taken from the list of orders

Result

OK will be sent back to you if the cancel happened and is fine otherwise an error code and message will be displayed

Buy Order

POST https://api.quadrigacx.com/private/buy

Payload

  • Authentication
  • major – The Major currency you want to buy
  • minor – The minor currency you want to buy with
  • amount – The amount of Major to be purchased
  • rate – The Price you are willing to pay

Result

OK will be sent back to you if the buy happened and is fine otherwise an error code and message will be displayed

Sell Order

POST https://api.quadrigacx.com/private/sell

Payload

  • Authentication
  • major – The Major currency you want to sell
  • minor – The minor currency you want to sell with
  • amount – The amount of Major to sell
  • rate – The Price you want to sell for

Result

OK will be sent back to you if the sell happened and is fine otherwise an error code and message will be displayed

Deposit

POST https://api.quadrigacx.com/private/deposit

Payload

  • Authentication
  • currency – The currency you want to deposit (BTC)

Result

A JSON object of the structure:

  • address – a Bitcoin address you send the funds to

Withdraw

POST https://api.quadrigacx.com/private/withdraw

Payload

  • Authentication
  • currency – The currency you want to withdraw (BTC)
  • amount – The amount to withdraw
  • address – The bitcoin address we will send the amount to

Result

OK or error

It is important to note that if you have specified a Withdrawal Bitcoin Address in the API setup, it will reject any request that does not match.

Appendix

PHP Examples

You must be familiar with PHP - https://php.net - and the CURL extension - https://php.net/curl

Rates

$ch = curl_init('http://api.quadrigacx.com/public/rates');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$result = curl_exec($ch);
Result
{
    "btc": {
        "cad": "888.00"
    }
}

My Orders

$nonce     = time(); // Unix timestamp
$key       = 'JJHlXeDcFM'; // My API Key
$client    = 3; // My Client ID
$secret    = '230664ae53cbe5a07c6c389910540729'; // My secret
$signature = hash_hmac('sha256', $nonce . $key . $client, $secret); // Hashing it
$data = array(
    'key'       => $key,
    'nonce'     => $nonce,
    'signature' => $signature
);
$data_string = json_encode($data);
$ch = curl_init('https://api.quadrigacx.com/private/orders');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json; charset=utf-8',
    'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);

Add a new Buy Order

$nonce     = time(); // Unix timestamp
$key       = 'JJHlXeDcFM'; // My API Key
$client    = 3; // My Client ID
$secret    = '230664ae53cbe5a07c6c389910540729'; // My secret
$signature = hash_hmac('sha256', $nonce . $key . $client, $secret); // Hashing it
$data = array(
    'key'       => $key,
    'nonce'     => $nonce,
    'signature' => $signature
);
$data_string = json_encode($data);
$ch = curl_init('https://api.quadrigacx.com/private/buy');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json; charset=utf-8',
    'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);