NAV Navbar
shell javascript
  • Introduction
  • Rate limits
  • Products
  • Markets
  • Order Book
  • Errors
  • Websocket Feed
  • Introduction

    Welcome to Rockpool API documentation. Rockpool API provides market data from multiple cryptocurrency exchanges as both separate data feeds and aggregated order book.

    Rate limits

    Order book endpoints are rate limited. It is allowed to make 60 requests per minute. Rate limiting is seperate for every product/market. For real-time order book data we recommend using our websocket data feed. When a rate limit is exceeded, a status of 429 Too Many Requests will be returned.

    Products

    Get all products

    curl "http://pool.rockchain.com/api/products"  
    

    JSON response example:

    [
      {
        "id": "btc-usd",
        "name": "BTC/USD",
        "markets": [
          {
            "id": "gdax",
            "name": "GDAX"
          },
          {
            "id": "bitstamp",
            "name": "Bitstamp"
          }
        ]
      },
      {
        "id": "eth-eur",
        "name": "ETH/EUR",
        "markets": [
          {
            "id": "kraken",
            "name": "Kraken"
          }
        ]
      }
    ]
    

    Get a list of all available products.

    HTTP Request

    GET http://pool.rockchain.com/api/products

    Output parameters

    Parameter Description
    id Product ID
    name Full product name
    markets List of all markets where the product is available

    Get product detail

    curl "http://pool.rockchain.com/api/products/btc-usd"  
    

    JSON response example:

    {
        "id": "btc-usd",
        "name": "BTC/USD",
        "markets": [
          {
            "id": "gdax",
            "name": "GDAX"
          },
          {
            "id": "bitstamp",
            "name": "Bitstamp"
          }
        ]
    }
    

    Get a specific product detail.

    HTTP Request

    GET http://pool.rockchain.com/products/<id>

    URL Parameters

    Parameter Description
    id The ID of the product to retrieve.

    Output parameters

    Parameter Description
    id Product ID
    name Full product name
    markets List of all markets where the product is available

    Markets

    Get all markets

    curl "http://pool.rockchain.com/api/markets"  
    

    JSON response example:

    [
      {
        "id": "gdax",
        "name": "GDAX",
        "markets": [
          {
            "id": "btc-usd",
            "name": "BTC/USD"
          },
          {
            "id": "ltc-usd",
            "name": "LTC/USD"
          }
        ]
      },
      {
        "id": "coinfloor",
        "name": "Coinfloor",
        "markets": [
          {
            "id": "kraken",
            "name": "Kraken"
          }
        ]
      }
    ]
    

    Get a list of all available markets.

    HTTP Request

    GET http://pool.rockchain.com/api/markets

    Output parameters

    Parameter Description
    id Market ID
    name Market name
    products List of delivered products

    Get market detail

    curl "http://pool.rockchain.com/api/markets/gemini"  
    

    JSON response example:

    {
        "id": "gemini",
        "name": "Gemini",
        "products": [
          {
            "id": "btc-usd",
            "name": "GDAX"
          }      
        ]
    }
    

    Get a market detail.

    HTTP Request

    GET http://pool.rockchain.com/markets/<id>

    URL Parameters

    Parameter Description
    id The ID of the market to retrieve.

    Output parameters

    Parameter Description
    id Product ID
    name Market name
    products List of delivered products

    Order Book

    Aggregated order book

    curl "http://pool.rockchain.com/api/order-book/btc-usd?level=1"  
    

    JSON response example:

    {
        "productId": "btc-usd",
        "level": 1,
        "timestamp": 1512462535952,
        "asks": [
            [
                "11725.14",
                "0.05321898",
                "gdax",
                "GDAX"
            ]
        ],
        "bids": [
            [
                "11804.6",
                "0.00593559",
                "bitstamp",
                "Bitstamp"
            ]
        ]
    }
    

    The endpoint retrieves aggregated order book data from all supported markets for specified product.

    HTTP request

    GET http://pool.rockchain.com/api/order-book/<productId>?level=<level>

    URL parameters

    Parameter Description
    productId Product ID for which is order book data retrieved

    Query parameters

    Parameter Description
    level Optional. Order book level. 1 = Best BID, ASK price/volume pairs, 2 = data by price levels. Default value is 1.

    Output parameters

    Parameter Description
    productId Order book data product ID
    level Order book data level. 1 = Best BID, ASK price/volume pairs, 2 = consolidated data by price levels
    timestamp UNIX timestamp in milliseconds
    asks Array of ask price/volume/marketId/marketName data in ascending order, ordered by price.
    bids Array of bid price/volume/marketId/marketName data in descending order, ordered by price.

    Market order book

    curl "http://pool.rockchain.com/api/order-book/btc-usd/bitstamp?level=1"  
    

    JSON response example:

    {
        "productId": "btc-usd",
        "level": 1,
        "timestamp": 1512464047539,
        "asks": [
            [
                "11759",
                "0.02583542"
            ]
        ],
        "bids": [
            [
                "11854.7",
                "6"
            ]
        ],
        "marketId": "bitstamp"
    }
    

    Get order book data for specific market and product.

    HTTP request

    GET http://pool.rockchain.com/api/order-book/<productId>/<marketId>?level=<level>

    URL parameters

    Parameter Description
    productId Product ID for which is order book data retrieved
    marketId Market ID for which is order book retrieved

    Query parameters

    Parameter Description
    level Optional. Order book level. 1 = Best BID, ASK price/volume pairs, 2 = consolidated data by price levels. Default value is 1.

    Output parameters

    Parameter Description
    productId Order book data product ID
    level Order book data level. 1 = Best BID, ASK price/volume pairs, 2 = consolidated data by price levels
    timestamp UNIX timestamp in milliseconds
    asks Array of ask price/volume pairs in ascending order, ordered by price.
    bids Array of bid price/volume pairs in descending order, ordered by price.
    marketId Order book market ID

    Prices are specified in product's counter currency, e.g. USD for BTC/USD product.

    Errors

    {
        "status": 404,
        "error": "Not Found",
        "message": "Market bitsstamp not found",
        "time": "Tue Dec 05 12:51:44 CET 2017"
    }
    

    On error API returns error object with following fields:

    Name Description
    status HTTP status code
    error Basic error description
    message More detailed error description
    time Date and time when error happened

    The Rockpool API uses the following HTTP status error codes:

    Error Code Meaning
    400 Bad Request -- Bad request format.
    404 Not Found -- The specified item could not be found.
    429 Too Many Requests -- Your request limit for an endpoint has been reached. Make requests at slower rate.
    500 Internal Server Error -- We had a problem with our server. Try again later.

    Websocket Feed

    Rockpool websocket feed provides real-time order book data using STOMP (Simple Text Oriented Messaging Protocol).

    http://stomp.github.io/

    http://jmesnil.net/stomp-websocket/doc/

    Websocket url: ws://pool.rockchain.com/ws/websocket

    Product order book subscription

    var socket = new WebSocket('ws://pool.rockchain.com/ws/websocket');
    stompClient = Stomp.over(socket);
    stompClient.connect({}, function(frame) {
        stompClient.subscribe('/topic/order-book/level1/btc-usd', function(messageOutput) {
            console.log(JSON.parse(messageOutput.body));
        });    
    });
    

    Example JSON response:

    {
        "productId": "btc-usd",
        "level": 1,
        "timestamp": 1512462535952,
        "asks": [
            [
                "11725.14",
                "0.05321898",
                "kraken",
                "Kraken"
            ]
        ],
        "bids": [
            [
                "11804.6",
                "0.00593559",
                "gdax",
                "GDAX"
            ]
        ]
    }
    

    GET /topic/order-book/<level>/<productId>

    Parameters

    Name Description
    level Order book level. Order book level. level1 = Best BID, ASK price/volume pairs, level2 = consolidated data by price levels.
    productId Product ID

    Output parameters

    Parameter Description
    productId Order book data product ID
    level Order book data level. 1 = Best BID, ASK price/volume pairs, 2 = consolidated data by price levels
    timestamp UNIX timestamp in milliseconds
    asks Array of ask price/volume/marketId/marketName data in ascending order, ordered by price.
    bids Array of bid price/volume/marketId/marketName data in descending order, ordered by price.

    Market order book subscription

    var socket = new WebSocket('ws://pool.rockchain.com/ws/websocket');
    stompClient = Stomp.over(socket);
    stompClient.connect({}, function(frame) {
        stompClient.subscribe('/topic/order-book/level1/btc-usd/gdax', function(messageOutput) {
            console.log(JSON.parse(messageOutput.body));
        });    
    });
    

    Example JSON response:

    {
        "productId": "btc-usd",
        "level": 1,
        "timestamp": 1512462535952,
        "asks": [
            [
                "11725.14",
                "0.05321898"
            ]
        ],
        "bids": [
            [
                "11804.6",
                "0.00593559"
            ]
        ],
        "marketId": "gdax"
    }
    

    /topic/order-book/<level>/<productId>/<marketId>

    Parameters

    Name Description
    level Order book level. Order book level. level1 = Best BID, ASK price/volume pairs, level2 = consolidated data by price levels.
    productId Product ID
    marketId Market ID

    Output parameters

    Parameter Description
    productId Order book data product ID
    level Order book data level. 1 = Best BID, ASK price/volume pairs, 2 = consolidated data by price levels
    timestamp UNIX timestamp in milliseconds
    asks Array of ask price/volume pairs in ascending order, ordered by price.
    bids Array of bid price/volume pairs in descending order, ordered by price.
    marketId Order book market ID

    Refresh product order book message

    var socket = new WebSocket('ws://pool.rockchain.com/ws/websocket');
    stompClient = Stomp.over(socket);
    stompClient.connect({}, function(frame) {
        stompClient.subscribe('/topic/order-book/level1/btc-usd', function(messageOutput) {
            console.log(JSON.parse(messageOutput.body));
        });    
    });
    
    //Send refresh message
    stompClient.send('/message/refresh/level1/btc-usd');
    

    Refresh product order book message. Calling refresh message sends message with current order book data to corresponding product topic.

    /message/refresh/<level>/<productId>

    Parameters

    Name Description
    level Order book level. Order book level. level1 = Best BID, ASK price/volume pairs, level2 = consolidated data by price levels.
    productId Product ID

    Refresh market order book message

    var socket = new WebSocket('ws://pool.rockchain.com/ws/websocket');
    stompClient = Stomp.over(socket);
    stompClient.connect({}, function(frame) {
        stompClient.subscribe('/topic/order-book/level1/btc-usd/gdax', function(messageOutput) {
            console.log(JSON.parse(messageOutput.body));
        });    
    });
    
    //Send refresh message
    stompClient.send('/message/refresh/level1/btc-usd/gdax');
    

    Refresh market order book message. Calling refresh message sends message with current order book data to corresponding market/product topic.

    /message/refresh/<level>/<productId>/<marketId>

    Parameters

    Name Description
    level Order book level. Order book level. level1 = Best BID, ASK price/volume pairs, level2 = consolidated data by price levels.
    productId Product ID
    marketId Market ID