TheRockTrading Websocket API

Documentation

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('bb1fafdf79a00453b5af');
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,
  "side": "sell"
}
                  
var pusher = new Pusher('bb1fafdf79a00453b5af');
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

{
  "dayv_base_currency": {
    "value": 366526.05,
    "currency": "EUR"
  },
  "dayv_trade_currency": {
    "value": 5745.74,
    "currency": "ETH"
  }
}
                  
var pusher = new Pusher('bb1fafdf79a00453b5af');
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('bb1fafdf79a00453b5af');
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('bb1fafdf79a00453b5af');
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.