The Rock Trading Application Platform Interface

Introduction

You can use our API calls to automate common actions on The Rock Trading.

HOW

The request is done by the standard HTTP GET/POST methods, in return you get a JSON object.
It is important to set the request Content-Type to 'application/json' in the HTTP Header.
Note that there is a request limit which is 5 API calls per second.


Market API

ticker

The API call to obtain market ticker can be made at:

GET https://www.therocktrading.com/api/ticker/#{fund_name}

Params:

  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • symbol - string representation of the specified fund
  • bid - best bid value of fund_name
  • ask - best ask value of fund_name

tickers

The API call to obtain all market tickers can be made at:

GET https://www.therocktrading.com/api/tickers/#{exchange}

Params:

  • exchange (optional) - "currency" to restrict to only currency exchange tickers, "stock" to restrict to only stock exchange tickers. Leave empty to get all.
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • an array of symbols and their tickers

orderbook

Full market orderbook for each fund, stock or currency is available through the orderbook API call. The API call can be made at:

GET https://www.therocktrading.com/api/orderbook/#{fund_name}

Params:

  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • asks - array whose first member is the actual price and the second is the available quantity at that price
  • bids - array which first member is the actual price and the second is the available quantity at that price

trades

The API call to obtain latest market trades can be made at:

GET https://www.therocktrading.com/api/trades/#{fund_name}

Params:

  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
  • since (optional) - get only trades executed after a certain unix timestamp
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • date - when the trade has been executed
  • price - the price set for this trade
  • amount - the quantity traded
  • tid - the id of the trade

Trading API

Note that these API require authentication. In order to authenticate you need an account on TRT and an API key (you can request one by writing an email to info@therocktrading.com).

get_balance

The API call to obtain the balance of an account for a specific type of currency:

POST https://www.therocktrading.com/api/get_balance

Params:

  • username
  • password
  • api_key
  • type_of_currency - the currency you want to get the balance of
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • currency - the currency you have requested the balance of
  • balance - the actual balance
  • trading_balance - the balance available for placing orders

get_orders

The API call to obtain a list of the active orders of an account:

POST https://www.therocktrading.com/api/get_orders

Params:

  • username
  • password
  • api_key
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • orders - array of orders containing id, fund_id, fund_name, type, price, amountOpen, amountUnfilled

place_order

The API call to place a new order of an account:

POST https://www.therocktrading.com/api/place_order

Params:

  • username
  • password
  • api_key
  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
  • order_type - B for Buy order or S for Sell order
  • amount - the amount you want to Buy/Sell
  • price - the price for your order to be filled
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • order_id - the id of the newly created order

cancel_order

The API call to cancel an active order of an account:

POST https://www.therocktrading.com/api/cancel_order

Params:

  • username
  • password
  • api_key
  • order_id - the id of the order you want to cancel
Returns:
  • errorCode - "OK" on success, "ERROR" on failure