Taurus API

Overview

The Taurus API allows you to integrate the Taurus 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.

The Taurus API is fully compatible with the Bitstamp Exchange API.

Taurus notations

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

Minor denotes fiat currencies such as Canadian Dollar (CAD), etc.

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


Public Functions

Current Trading Information

GET https://api.taurusexchange.com/ticker

The above url will return trading information from the specified book. Currently, the book will default to the only one available: btc_cad

Result

Returns JSON dictionary:

  • last - last BTC price
  • high - last 24 hours price high
  • low - last 24 hours price low
  • vwap - last 24 hours volume weighted average price: vwap
  • volume - last 24 hours volume
  • bid - highest buy order
  • ask - lowest sell order

Order Book

GET https://api.taurusexchange.com/order_book

List of all open orders

Params:

  • book - optional book to return orders for. Default btc_cad.
  • group - optional group orders with the same price (0 - false; 1 - true). Default: 1.

Result

Returns JSON dictionary with "bids" and "asks". Each is a list of open orders and each order is represented as a list of price and amount.

Transactions

GET https://api.taurusexchange.com/transactions

List of recent trades

Params:

  • book - book to return orders for (optional, default btc_cad)
  • time - time frame for transaction export ("minute" - 1 minute, "hour" - 1 hour). Default: hour.

Result

Returns descending JSON list of transactions. Every transaction (dictionary) contains:

  • date - unix timestamp date and time
  • tid - transaction id
  • price - BTC price
  • amount - BTC amount

API Authentication

Setup

To setup an API within your account, go to Settings & Security and scroll down to "API Setup".

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.

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 )

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

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

The signature being calculated using:

HMAC_SHA256 ( 1391683499 + 3 + JJHlXeDcFM , 230664ae53cbe5a07c6c389910540729)
HMAC_SHA256 ( 13916834993JJHlXeDcFM , 230664ae53cbe5a07c6c389910540729 )
= cdbf5cc64c70e1485fcf976cdf367960c2b28cfc28080973ce677cebb6db9681

Private Functions

Account balance

POST https://api.taurusexchange.com/balance

Params

  • key - API key
  • signature - signature
  • nonce - nonce

Result

Returns JSON dictionary of all balances, e.g.:

  • cad_balance - cad balance
  • btc_balance - BTC balance
  • cad_reserved - cad reserved in open orders
  • btc_reserved - BTC reserved in open orders
  • cad_available - cad available for trading
  • btc_available - BTC available for trading
  • fee - customer trading fee

User Trasactions

POST https://api.taurusexchange.com/user_transactions

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • offset - skip that many transactions before beginning to return results. Default: 0.
  • limit - limit result to that many transactions. Default: 100.
  • sort - sorting by date and time (asc - ascending; desc - descending). Default: desc.
  • book - optional, if not specified, will default to btc_cad

Result

Returns descending JSON list of transactions. Every transaction (dictionary) contains:

  • datetime - date and time
  • id - transaction id
  • type - transaction type (0 - deposit; 1 - withdrawal; 2 - market trade)
  • (minor currency code) – the minor currency amount
  • (minor currency code) – the major currency amount
  • fee – transaction fee
  • order_id - a 64 character long hexadecimal string representing the order that was fully or partially filled

Open Orders

POST https://api.taurusexchange.com/open_orders

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • book - optional, if not specified, will default to btc_cad

Result

Returns JSON list of open orders. Each order is represented as dictionary:

  • id - order id
  • datetime - date and time
  • type - buy or sell (0 - buy; 1 - sell)
  • price - price
  • amount - amount

Lookup Order

POST https://api.taurusexchange.com/lookup_order

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • id – a single or array of 64 characters long hexadecimal string taken from the list of orders

Result

Returns JSON list of details about 1 or more orders. Each order is represented as dictionary:

  • id - the order id passed to that function
  • book - which orderbook it belongs to
  • price - price of the order
  • amount - amount of the order
  • type - buy or sell (0 - buy; 1 - sell)
  • status - status of the order (-1 - cancelled; 0 - active; 1 - partially filled; 2 - complete)
  • created - date the order was created
  • updated - date the order was last updated (not shown when status = 0)

Cancel Order

POST https://api.taurusexchange.com/cancel_order

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • id – a 64 characters long hexadecimal string taken from the list of orders

Result

Returns 'true' if order has been found and canceled.

Buy Order - Limit Order

POST https://api.taurusexchange.com/buy

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • amount - amount of major currency
  • price - price to buy at
  • book - optional, if not specified, will default to btc_cad

Result / Limit Order

Returns JSON dictionary representing order:

  • id - order id
  • datetime - date and time
  • type - buy or sell (0 - buy; 1 - sell)
  • price - price
  • amount - amount

Buy Order - Market Order

POST https://api.taurusexchange.com/buy

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • amount - amount of minor currency to spend
  • book - optional, if not specified, will default to btc_cad

Result / Market Order

Returns JSON dictionary representing market order:

  • amount - the total amount of the major currency purchased
  • orders_matched - a set of amount/price pairs, one for each order that was matched in the trade

Sell Order - Limit Order

POST https://api.taurusexchange.com/sell

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • amount - amount of major currency
  • price - price to sell at
  • book - optional, if not specified, will default to btc_cad

Result / Limit Order

Returns JSON dictionary representing order:

  • id - order id
  • datetime - date and time
  • type - buy or sell (0 - buy; 1 - sell)
  • price - price
  • amount - amount

Sell Order - Market Order

POST https://api.taurusexchange.com/sell

Params

  • key - API key
  • signature - signature
  • nonce - nonce
  • amount - amount of major currency to sell
  • book - optional, if not specified, will default to btc_cad

Result / Market Order

Returns JSON dictionary representing market order:

  • amount - the total amount of the minor currency acquired in the sale
  • orders_matched - a set of amount/price pairs, one for each order that was matched in the trade

Bitcoin Deposit

POST https://api.taurusexchange.com/bitcoin_deposit_address

Payload

  • key - API key
  • signature - signature
  • nonce - nonce

Result

Returns a bitcoin deposit address for funding your account.

Bitcoin Withdraw

POST https://api.taurusexchange.com/bitcoin_withdrawal

Payload

  • key - API key
  • signature - signature
  • nonce - nonce
  • amount – The amount to withdraw
  • address – The bitcoin address we will send the amount to

Result

OK or error


Appendix

Ruby Examples

Ruby wrapper for Taurus: https://github.com/yerofeyev/taurusruby.

Java Examples

Java integration for Taurus (xChange): https://github.com/timmolter/XChange.

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.taurusexchange.com/ticker');
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HEADER, false);
            $result = curl_exec($ch);
Result
            {
                "high":"8650.00",
                "last":"8500.00",
                "timestamp":"1410341807",
                "bid":"8310.00",
                "vwap":"8414.15",
                "volume":"107.05882350",
                "low":"8480.00",
                "ask":"8500.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.taurusexchange.com/open_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,
                'amount'    => 2.34,
                'price'     => 8469
            );
            $data_string = json_encode($data);
            $ch = curl_init('https://api.taurusexchange.com/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);