RADAR RELAY V2

We’ve updated to 0x V2.See what changed.

Retreiving Market Data

This tutorial walks you through retreving Radar Relay market data.
Using the REST api to retrieve market data does not require an account or API key
but API requests are limited to 120/min.

1

Listing Available Tokens

To obtain a list of tokens that are currently available or were previously available on Radar Relay. Use the v2/tokens endpoint.

Endpoint Details

List Tokens

$ curl https://api.radarrelay.com/v2/tokens
2

Listing Available Markets

To obtain a list of markets that are currently available available on Radar Relay. Use the v2/markets endpoint.

Endpoint Details

List Markets

$ curl https://api.radarrelay.com/v2/markets
3

Listing Market Data

To obtain market data. Pass a market id from the previous example into a market data endpoint./v2/markets/zrx-weth/book

The available market data endpoints are: book | fills | ticker | candles

Endpoint Details

Get ZRX-WETH Book

$ curl https://api.radarrelay.com/v2/markets/zrx-weth/book
4

Websockets

To subscribe to a book websocket. Send a RadarSubscribeRequest to the websocket endpoint. wss://ws.radarrelay.com/v2

Details

Book Subscription


// npm install websocket@1.0.25 --save
const WebSocketClient = require('websocket').client;
const client = new WebSocketClient({tlsOptions: {rejectUnauthorized: false}});
let lastPing = new Date().getTime();

client.on('connectFailed', function(error) {
    console.log('Connect Error: ' + error.toString());
});

client.on('connect', function(connection) {
    console.log('Connected to Server...');
    connection.on('error', function(error) {
        console.log("Connection Error: " + error.toString());
    });
    connection.on('close', function() {
        console.log('Connection Closed');
    });
    connection.on('message', function(message) {
      if (message.type === 'utf8') {
        console.log(message.utf8Data);
      }
    });
    connection.on('pong', function(){
      console.log('[pingpong] response took', (new Date().getTime() - lastPing) + 'ms');
    })

    function send(message) {
      if (connection.connected) {
          connection.sendUTF(message);
      }
    }

    // subscribe with snapshot
    send(`{
      "type": "SUBSCRIBE",
      "topic": "BOOK",
      "market": "ZRX-WETH", // e.g. 'ZRX-WETH'
      "requestId": 1 // optional requestId
    }`);

    // Send a ping every 10s
    // to keep the connection live
    setInterval(function(){
      lastPing = new Date().getTime();
      connection.ping();
    }, 10000);
});

client.connect('wss://ws.radarrelay.com/v2');
Download Example
REST API

View REST API Documentation