TheRockTrading API

Documentation Reference Links

The current API in use is API v1. This API are restful and support multiple apikeys with different permissions. The old API are still available (see old documentation here) and are now also replicated on API v0. We plan to dismiss the old API in september 2015, while retaining API v0 longer.

API v1

The current version in use for our API.

Use api.therocktrading.com as endpoint. Full documentation is available here.

API v0

These one mimics the first API available at therocktrading years ago, but use the api.therocktrading.com endpoint for better performances.

These API are old, so you should not use them anymore. Can still be useful if you have old trading bots that do not want to change soon, or if you plan to do basic stuffs.

API Websocket

These public API provides informations on trades and orderbook, via websockets.

Websocket feed provides realtime market data.

Documentation and Examples

Pusher JS lib:

<script src="http://js.pusher.com/2.2/pusher.min.js" type="text/javascript"></script>
            

NEW OFFER

Get the new best offer (bid or ask) per fund symbol.

CHANNEL: currency  EVENT: new_offer

{
  "symbol": "BTCUSD",
  "value": 277.45,
  "type": "ask"
}
                  
var pusher = new Pusher('8458eb6fbd288f0cf3d8');
var trades_channel = pusher.subscribe('currency');
trades_channel.bind('new_offer', function(data) {
  console.log(data);
});
                  

LAST TRADE

Get last trades information.

CHANNEL: currency  EVENT: last_trade

{
  "symbol": "LTCEUR",
  "quantity": 0.2,
  "value": 3.05,
  "volume": 0.61,
  "time": "2015-07-20T10:23:19+02:00",
  "diff": 0,
  "dark": false
}
                  
var pusher = new Pusher('8458eb6fbd288f0cf3d8');
var trades_channel = pusher.subscribe('currency');
trades_channel.bind('last_trade', function(data) {
  console.log(data);
});
                  

See a complete code example here.

LAST VOLUME

Get last volume information.

CHANNEL: currency  EVENT: last_volume

{
  "symbol": "LTCEUR",
  "quantity": 0.2,
  "value": 3.05,
  "volume": 0.61,
  "time": "2015-07-20T10:23:19+02:00",
  "diff": 0,
  "dark": false
}
                  
var pusher = new Pusher('8458eb6fbd288f0cf3d8');
var trades_channel = pusher.subscribe('currency');
trades_channel.bind('last_volume', function(data) {
  console.log(data);
});
                

ORDERBOOK_DIFF

Get orderbook differences only. A zero amount means order deleted.

CHANNEL: fund symbol  EVENT: orderbook_diff

{
  "side": "ask",
  "price": 277.35,
  "amount": 0.67
}
                  
var pusher = new Pusher('8458eb6fbd288f0cf3d8');
var order_book_channel = pusher.subscribe('BTCUSD');

order_book_channel.bind('orderbook_diff', function(data) {
  console.log("price: " + data['price']);
  console.log("amount: " + data['amount']);
});
                  

order deleted if amount == 0

See a complete code example here.

ORDERBOOK

Get first 20 orderbook rows on order book changes.

CHANNEL: fund symbol  EVENT: orderbook

{
  "asks": [
    {
      "price": 277.36,
      "amount": 0.82
    }
   ],
  "bids": [
    {
      "price": 263.14,
      "amount": 0.08
    }
  ]
}
                  
var pusher = new Pusher('8458eb6fbd288f0cf3d8');
var order_book_channel = pusher.subscribe('BTCUSD');

order_book_channel.bind('orderbook', function(data) {
  console.log("bids: " + data['bids']);
  console.log("asks: " + data['asks']);
});  
                  

See a complete code example here.