Tradedo Exchange REST API Documentation

Welcome to the Tradedo Exchange REST API documentation. This API (Application Programming Interface) will allow you to access the functionality of this exchange by means of HTTP requests, making integration with your own applications possible.

Connecting to the API

You can access the API at the following url:

https://tradedo.io/api

You are permited to make up to 60 requests a minute.

Usage

In order to use a public API method, you must make an HTTP request to the appropriate endpoint for that particular method, sending the appropriate GET or POST parameters for that method. You can also send them in the PAYLOAD of the request in JSON format.

To access protected API methods, you must obtain an API key/secret pair. Their usage is explained further ahead in this document.

Here are a few basic usage examples:

# Example request using CURL on the command line
curl "https://tradedo.io/api/index.php?endpoint=transactions" \
-d currency="BTC" \
-d limit=5  
// Example valid response
{"transactions": {
    "0":{"id":"131","date":"2014-11-13 10:42:46","aur":"1.00000000","maker_type":"buy","price":"10.00","amount":"10.00","currency":"BTC"},
    "1":{"id":"129","date":"2014-11-11 11:14:12","aur":"0.50000000","maker_type":"buy","price":"11.27","amount":"5.63","currency":"BTC"},
    "2":{"id":"128","date":"2014-11-11 11:13:49","aur":"0.50000000","maker_type":"buy","price":"10.91","amount":"5.46","currency":"BTC"},
    "3":{"id":"127","date":"2014-11-10 18:29:15","aur":"0.50000000","maker_type":"buy","price":"11.20","amount":"5.60","currency":"BTC"},
    "4":{"id":"126","date":"2014-11-10 18:25:21","aur":"0.50000000","maker_type":"buy","price":"11.20","amount":"5.60","currency":"BTC"},
    "request_currency":"BTC"
    }
}
// Example error response
{"errors":[{"message":"Invalid currency.","code":"INVALID_CURRENCY"}]}

 

Public API Methods

These methods can be accessed without an account or API key.

Order Book

Returns information on all the orders currently in the order book. Return will be grouped into two different arrays for bid and ask respectively.

GET https://tradedo.io/api/index.php?endpoint=order-book

Parameters:

  • market (string) - Three-letter currency code. If omitted, will return the exchange default. Must be a market supported by the exchange.
  • currency (string) - Three-letter currency code. Will return the exchange default if omitted. Must be a currency supported by the exchange.

Response:

  • market(string) - The currency code of the selected market.
  • currency (string) - The currency code for the selected currency.
  • price (float) - The limit price of the order.
  • order_amount (float) - The remaining amount in BTC.
  • order_value (float) - The remaining value of the order in your requested currency.
  • converted_from (string) - The original currency in which the order was placed, if not equal to the requested currency.

Transactions

Get the latest transactions that ocurred in the exchange, ordered by date in descending order.

GET https://tradedo.io/api/index.php?endpoint=transactions

Parameters:

  • market (string) - Three-letter currency code. Please note: You can omit this parameter to receive all trades from all markets!
  • currency (string) - Three-letter currency code. Please note: You can omit this parameter to receive all prices will be in their native currency!
  • limit (int) - The amount of records to receive. Default is 10.

Response:

  • market(string) - The currency code of the selected market.
  • currency (string)The currency in which this information is presented. Will return 'ORIGINAL' if amounts are in the original currency
  • id (int) - A unique identifier for the transaction.
  • date (string) - The date string in YYYY-MM-DD format.
  • amount (float) - The transaction amount in BTC.
  • price (float) - The price at which the transaction ocurred. Will be returned in the original currency if no currency parameter is sent in the request.
  • price1 (float)Only if no currency param sent - The price at which the transaction ocurred for the second party (maker), in the original currency.
  • value (float) - The transction amount in the requested currency. Will be returned in the original currency if no currency parameter is sent in the request.
  • value1 (float)Only if no currency param sent - The transaction amount in the second party's (maker's) original currency.
  • currency (string) - The currency in which the transaction ocurred. Will be returned in the original currency if no currency parameter is sent in the request.
  • currency1 (string)Only if no currency param sent - The second party's (maker's) original currency.

 

Generate Signature

To generate signature, you must include the following parameters in your POST parameters or the JSON PAYLOAD of your request:

POST https://tradedo.io/api/index.php?endpoint=generate-signature

Parameters:

  • api_key (string) - The API key that you generated.
  • api_secret (string) - The API secret that was generated together with the api_key

Response:

  • signature(string) - An HMAC-SHA256 signature of the JSON-encoded parameters of the request, signed using the API secret that was generated together with the api_key. These parameters include the api_key and nonce. This signature should then be added to the request parameters.
  • nonce (int)A random integer.

 

Protected API Methods

In order to access these methods, you must obtain an API key/secret pair to authenticate your request.

Obtaining An API Key

To get access to our API, you must generate an API key on the API Access page. You must have two-factor authentication enabled on your account to be able to view this page. Upon generating a new API key, you will be given an API secret code. This value will only be shown to you once. Please store it in a secure place, as you will need it to use it together with your API key.

Once you have generated an API key, you can allow or restrict it's holder's access to the parent account's functionality by checking or unchecking the checkboxes in the "permissions" line under the API key.

Authenticating Your Request

To authenticate a request with your API key/secret pair, you must include the following parameters in your POST parameters or the JSON PAYLOAD of your request:

  • api_key (string) - The API key that you generated.
  • nonce (int) - A random integer. Each request must have a higher nonce than the last one. You can use the current UNIX timestamp for example.
  • signature (string) - An HMAC-SHA256 signature of the JSON-encoded parameters of the request, signed using the API secret that was generated together with the api_key. These parameters include the api_key and nonce. This signature should then be added to the request parameters.

We know that generating a signature might be a bit intimidating if you're doing it for the first time, so please see the following examples:

// Javascript Example
    
// Uses http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/hmac-sha256.js
// ...and http://crypto-js.googlecode.com/svn/tags/3.0.2/build/components/enc-base64-min.js

// we add our public key and nonce to whatever parameters we are sending
var params = {};
params.currency = "btc";
params.price = 200;
params.api_key = api_key;
params.nonce = Math.round(new Date().getTime() / 1000);
    
// create the signature
var hash = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))), api_secret).toString()
    
// add signature to request parameters
params.signature = hash;
// PHP Example
    
// we add our public key and nonce to whatever parameters we are sending
$commands['side'] = 'sell';
$commands['type'] = 'stop';
$commands['api_key'] = $api_key;
$commands['nonce'] = time();
    
// create the signature
$signature = hash_hmac('sha256', base64_encode(json_encode($commands)), $api_secret);
    
// add signature to request parameters
$commands['signature'] = $signature;
# Python Example
    
import hashlib
import hmac
    
// we add our public key and nonce to whatever parameters we are sending
params = {'currency': 'btc', 'price': 200, 'api_key': api_key, 'nonce': time.time()}

// create the signature
message = bytes(json.dumps(params)).encode('utf-8')
secret = bytes(api_secret).encode('utf-8')
signature = hmac.new(secret, message, digestmod=hashlib.sha256).hexdigest()
    
// add signature to request parameters  
params['signature'] = signature   
// C# Example
    
using System.Security.Cryptography;

// we add our public key and nonce to whatever parameters we are sending
var params1 = new List>();
params1.Add(new KeyValuePair("api_key", api_key));
params1.Add(new KeyValuePair("nonce", (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds));
    
// create the signature
JavaScriptSerializer serializer = new JavaScriptSerializer();
var message = serializer.Serialize(params1);
    
secret = secret ?? "";
var encoding = new System.Text.ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
    byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
    var signature = BitConverter.ToString(hashmessage);
    signature = signature.Replace("-", "");
    
    // add signature to request parameters
    params1.Add(new KeyValuePair("signature", signature));
}
/* Java Example */
    
/* Dependent on Apache Commons Codec to encode in base64. */
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Hex;

/* we add our public key and nonce to whatever parameters we are sending */
Map params = new HashMap();
params.put("api_key", "demo");
params.put("nonce", ((int) (System.currentTimeMillis() / 1000L)));
    
/* create the signature */
String secret = "secret";
String message = new JSONObject(params).toString();

Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
sha256_HMAC.init(secret_key);

String hash = Hex.encodeHexString(sha256_HMAC.doFinal(message.getBytes()));

/* add signature to request parameters */
params.put("signature", hash);

Balances and Info

Obtain the account's balances and fee levels.

POST https://tradedo.io/api/index.php?endpoint=balances-and-info

Response:

  • on_hold[currency][withdrawal] (float) - The amount of a currency pending withdrawal.
  • on_hold[currency][order] (float) - The amount of a currency in open orders.
  • on_hold[currency][total] (float) - The total amount of a currency that is on hold - the sum of the last two items.
  • available[currency] (float) - The amount of that particular currency that is currently available.
  • btc_volume (float) - The account's 30-day trading volume converted to BTC (or the exchange's default currency).
  • fee_bracket[maker] (float) - The account's transaction fee level (as percentage), when not initiating the transaction (i.e. acting as a maker).
  • fee_bracket[taker] (float) - The account's transaction fee level (as percentage), when initiating the transaction (i.e. acting as a taker).
  • exchange_btc_volume (float) - Exchange-wide 24-hour transaction volume in BTC (or in the exchange's default cryptocurrency).

Open Orders

Get the account's current open orders, grouped by order side (bid or ask).

POST https://tradedo.io/api/index.php?endpoint=open-orders

Parameters:

  • market (string) - Three-letter currency code. If omitted, all orders will be returned. Must be a market supported by the exchange.
  • currency (string) - Three-letter currency code. Will filter by orders of this currency. When omitted, all open orders will be displayed.

Response:

  • id (int) - A unique identifier for the order.
  • side (string) - "buy" or "sell".
  • type (string) - "market", "limit" or "stop".
  • amount (float) - The original order amount in BTC.
  • amount_remaining (float) - The amount that has not yet been filled in BTC.
  • price (float) - The current price of the order in its native currency.
  • avg_price_executed (float) - A weighted average of the prices at which the order has been filled, in it's native currency. Zero means it has not yet generated any transactions.
  • stop_price (float) - If there is the order is a stop order, the price at which the stop will be triggered.
  • market(string) - The currency code of the selected market to which the order belongs.
  • currency (string) - The order's native currency.
  • status (string) - The order's current status. Possible values are 'ACTIVE','FILLED','CANCELLED_USER','OUT_OF_FUNDS','REPLACED'.
  • replaced (int) - If the order was edited, the order it replaced.
  • replaced_by (int) - If the order was replaced, the id of the order that replaced it.

User Transactions

Get a list of the account's transactions, ordered by date, in descending order.

POST https://tradedo.io/api/index.php?endpoint=user-transactions

Parameters:

  • market (string) - Three-letter currency code. If omitted, all orders will be returned. Must be a market supported by the exchange.
  • currency (string) - Three-letter currency code. Will filter by transactions involving this currency. When omitted, all transactions will be displayed.
  • limit (int) - The amount of transactions to return.
  • side (string) - Filters transactions by type ("buy" or "sell").

Response:

  • id (int) - A unique identifier for the transaction.
  • date (string) - The date string in YYYY-MM-DD format.
  • amount (float) - The transaction amount in BTC.
  • side (string) - Can be "buy" or "sell".
  • price (float) - The price at which the transaction ocurred, in it's native currency.
  • value (float) - The transction amount in it's native currency. 
  • fee (float) - The transaction fee in the native currency.
  • market(string) - The currency code of the selected market to which the order belongs.
  • currency (string) - The currency in which the transaction ocurred.

Existing Bitcoin Deposit Addresses

Get a list of the account's existing addresses for receiving Bitcoin.

POST https://tradedo.io/api/index.php?endpoint=crypto-deposit-address/get

Parameters:

  • market (string) - Three-letter currency code. Required to specify the cryptocurrency.
  • limit (int) - The amount of addresses to return.

Response:

  • address (string) - The address for depositing Bitcoin.
  • date (string) - The date created in YYYY-MM-DD HH:MM:SS format.

Get New Bitcoin Deposit Addresses

Get a new Bitcoin deposit address for the account.

POST https://tradedo.io/api/index.php?endpoint=crypto-deposit-address/new

Parameters:

  • market (string) - Three-letter currency code. Required to specify the cryptocurrency.

Response:

  • address (string) - The address for depositing Bitcoin.

Get Deposits

Get a list of deposits (crypto or fiat) made to the account, ordered by date, in descending order.

POST https://tradedo.io/api/index.php?endpoint=deposits/get

Parameters:

  • currency (string) - Three-letter currency code. Will filter by deposits involving this currency. When omitted, all deposits will be displayed.
  • limit (int) - The amount of deposits to return.
  • status (string) - Filters deposits by status ("pending", "completed" or "cancelled").

Response:

  • id (int) - A unique identifier for the deposit.
  • date (string) - The date string in YYYY-MM-DD HH:MM:SS format.
  • currency (string) - The currency of the deposit.
  • amount (float) - The amount of the deposit, in the deposit currency. 
  • status (string) - The current status of the transaction. Can be "PENDING", "COMPLETED" or "CANCELLED".
  • account_number (int) - The account number from which the deposit was made (only for fiat deposits).
  • address (string) - The Bitcoin address from which the deposit was made (only for BTC deposits).

Get Withdrawals

Get a list of withdrawals (crypto or fiat) from the account, ordered by date, in descending order.

POST https://tradedo.io/api/index.php?endpoint=withdrawals/get

Parameters:

  • currency (string) - Three-letter currency code. Will filter by withdrawals involving this currency. When omitted, all withdrawals will be displayed.
  • limit (int) - The amount of withdrawals to return.
  • status (string) - Filters withdrawals by status ("pending", "completed" or "cancelled").

Response:

  • id (int) - A unique identifier for the withdrawal.
  • date (string) - The date string in YYYY-MM-DD HH:MM:SS format.
  • currency (string) - The currency of the withdrawal.
  • amount (float) - The amount of the withdrawal, in the withdrawal currency. 
  • status (string) - The current status of the transaction. Can be "PENDING", "COMPLETED" or "CANCELLED".
  • account_number (int) - The account number to which the withdrawal was made (only for fiat withdrawal).
  • address (string) - The Bitcoin address to which the withdrawal was made (only for BTC withdrawals).

Place One (or Many) New Orders

Place one or many new orders from your account. To place multiple orders, you can send a multidimensional array called orders, which should contain all the parameters in each array element as specified below.

POST https://tradedo.io/api/index.php?endpoint=orders/new

Parameters:

  • market (string) - Three-letter currency code. Required. The market in which the order will be placed.
  • currency (string) - Three-letter currency code. The currency in which the order will be placed.
  • side (string) - Can be "buy" or "sell".
  • type (string) - Can be "market", "limit" or "stop". "stop" orders can contain both a stop_price and limit_price - they will be processed in an OCO (One Cancels the Other) fashion, which means that whichever one is executed first will cancel the other.
  • limit_price (float) - The limit price for the order, in the order currency.
  • stop_price (float) - The stop price for the order, in the order currency. A "stop" order can have both a stop and limit price as explained in "type".
  • amount (float) - The amount of BTC to buy or sell.
  • orders (array) - This parameter is used only if you intend to place multiple orders in one API request. It should be an array or JSON string containing all the previous parameters for each element, such that orders[n] = ['side'=>x,'type'=>y,...]. It can be a simple array of HTTP parameters, or can be formatted as JSON.

Response:

  • transactions (int) - The amount of transactions that ocurred upon placing the order.
  • new_order (int) - The amount of new orders placed (will return 2 if a stop order has both a limit_price and stop_price defined).
  • id (int) - A unique identifier for the withdrawal.
  • side (string) - Can be "buy" or "sell".
  • type (string) - Can be "market", "limit" or "stop".
  • amount (float) - The original BTC amount to buy or sell.
  • amount_remaining (float) - The outstanding (yet to be filled) BTC amount on the order.
  • price (float) - The current price of the order in its native currency.
  • avg_price_executed (float) - A weighted average of the prices at which the order has been filled, in it's currency. Zero means it has not yet generated any transactions.
  • stop_price (float) - If there is the order is a stop order, the price at which the stop will be triggered.
  • market (string) - The market in which the order was placed.
  • currency (string) - The order's native currency.
  • status (string) - The order's current status. Possible values are 'ACTIVE','FILLED','CANCELLED_USER','OUT_OF_FUNDS','REPLACED'.
  • oco (boolean) - If a stop order has both stop and limit prices, this will true since whichever is executed first will cancel the other.

Cancel One, Many or ALL Orders

Cancel one or many active orders. To cancel multiple orders, you can send a multidimensional array called orders, which should contain all the parameters in each array element as specified below. To cancel ALL orders, simply send a parameter called all - there is no need to send anything else.

POST https://tradedo.io/api/index.php?endpoint=orders/cancel

Parameters:

  • id (int) - The unique identifier of the order that you wish to edit.
  • orders (array) - This parameter is used only if you intend to get the status of multiple orders in one API call. It should be an array or JSON string containing an id parameter for each element, such that orders[n] = ['id'=>x]. It can be a simple array of HTTP parameters, or can be formatted as JSON.
  • all (bool) - Sending this parameter will cancel ALL orders. Use with caution!

Response:

  • id (int) - A unique identifier for the order.
  • side (string) - Can be "buy" or "sell".
  • type (string) - Can be "market", "limit" or "stop".
  • amount (float) - The original BTC amount when the order was placed or edited.
  • amount_remaining (float) - The outstanding (yet to be filled) BTC amount on the order.
  • price (float) - The current price of the order in its native currency.
  • avg_price_executed (float) - A weighted average of the prices at which the order has been filled, in it's currency. Zero means it has not yet generated any transactions.
  • stop_price (float) - If there is the order is a stop order, the price at which the stop will be triggered.
  • market (string) - The market in which the order was placed.
  • currency (string) - The order's currency.
  • status (string) - The order's current status. Possible values are 'ACTIVE','FILLED','CANCELLED_USER','OUT_OF_FUNDS','REPLACED'.
  • replaced (int) - The order it replaced, if it has been edited.
  • replaced_by (int) - The order that replaced it, if "REPLACED".

Status of One (or Many) Orders

Obtain the current state of one or many of the orders that have been placed by the account. To get multiple orders, you can send a multidimensional array called orders, which should contain all the parameters in each array element as specified below.

POST https://tradedo.io/api/index.php?endpoint=orders/status

Parameters:

  • id (int) - The unique identifier of the order that you wish to edit.
  • orders (array) - This parameter is used only if you intend to get the status of multiple orders in one API call. It should be an array or JSON string containing an id parameter for each element, such that orders[n] = ['id'=>x]. It can be a simple array of HTTP parameters, or can be formatted as JSON.

Response:

  • id (int) - A unique identifier for the order.
  • side (string) - Can be "buy" or "sell".
  • type (string) - Can be "market", "limit" or "stop".
  • amount (float) - The original BTC amount when the order was placed or edited.
  • amount_remaining (float) - The outstanding (yet to be filled) BTC amount on the order.
  • price (float) - The current price of the order in its native currency.
  • avg_price_executed (float) - A weighted average of the prices at which the order has been filled, in it's currency. Zero means it has not yet generated any transactions.
  • stop_price (float) - If there is the order is a stop order, the price at which the stop will be triggered.
  • market (string) - The market in which the order was placed.
  • currency (string) - The order's currency.
  • status (string) - The order's current status. Possible values are 'ACTIVE','FILLED','CANCELLED_USER','OUT_OF_FUNDS','REPLACED'.
  • replaced (int) - The order it replaced, if it has been edited.
  • replaced_by (int) - The order that replaced it, if "REPLACED".