NAV Navbar
  • REST API Specification
  • Feed API
  • Trade API
  • Accounts API
  • WebSocket API
  • REST API Specification

    Endpoints

    The Bamboo Relay REST API largely maintains parity with Radar Relay's REST API.

    Each of the networks may be addressed by first portion of the URL path.

    https://rest.bamboorelay.com/main/0x/
    https://rest.bamboorelay.com/ropsten/0x/
    https://rest.bamboorelay.com/rinkeby/0x/
    https://rest.bamboorelay.com/kovan/0x/
    

    Feed API

    GET /0x/tokens

    Retrieves a list of available tokens for trading. This endpoint is not paginated.

    Response

    [
        {
            "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "symbol": "WETH",
            "decimals": 18,
            "name": "WETH",
            "zeroex_official": 0,
            "active": 1,
            "quote": 0,
            "createdDate": "2019-05-12 09:42:04"
        },
        ...
    ]
    

    GET /0x/markets

    Retrieves a list of available markets given query parameters. This endpoint should be paginated.

    Parameters

    Query parameters:

    All parameters are optional.

    Response

    [
        {
            "id": "DAI-WETH",
            "baseTokenName": "Dai Stablecoin v1.0",
            "displayName": "DAI/WETH",
            "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "baseTokenId": 2,
            "quoteTokenId": 1,
            "baseTokenDecimals": 18,
            "quoteTokenDecimals": 18,
            "quoteIncrement": 8,
            "minOrderSize": "0.00000001",
            "maxOrderSize": "1000000000",
            "score": 100,
            "active": 1
        },
        ...
    ]
    

    GET /0x/markets/[marketId]

    Retrieves a single market.

    Parameters

    Query parameters:

    Response

    {
        "id": "DAI-WETH",
        "baseTokenName": "Dai Stablecoin v1.0",
        "displayName": "DAI/WETH",
        "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
        "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "baseTokenId": 2,
        "quoteTokenId": 1,
        "baseTokenDecimals": 18,
        "quoteTokenDecimals": 18,
        "quoteIncrement": 8,
        "minOrderSize": "0.00000001",
        "maxOrderSize": "1000000000",
        "score": 100,
        "active": 1
    }
    

    GET /0x/markets/[marketId]/ticker

    Retrieves a ticker for a single market.

    Parameters

    Query parameters:

    Response

    {
        "id": "DAI-WETH",
        "ticker: {
            "transactionHash": "0xad3f311566957f3ad344f0c052ec34f90da88cef6c95f5b7c591e7ebad026c2c",
            "price": "0.00442123",
            "size": "2.33490072",
            "timestamp": 1557908434,
            "bestBid": "0.00445460",
            "bestAsk": "0.00442167",
            "spreadPercentage": "-0.00744815"
        }
    }
    

    GET /0x/markets/[marketId]/stats

    Retrieves stats for a single market.

    Parameters

    Query parameters:

    Response

    {
        "id": "DAI-WETH",
        "stats: {
            "numBidsWithinRange": 22,
            "numAsksWithinRange": 39,
            "baseTokenAvailable": "19578.80553556",
            "quoteTokenAvailable": "125443.69785037",
            "volume24Hour": "557.83095306",
            "percentChange24Hour": "-3.60528868"
        }
    }
    

    GET /0x/markets/[marketId]/history

    Retrieves price history for a single market.

    Parameters

    Query parameters:

    Response

    {
        "id": "DAI-WETH",
        "history: {
            "price24Hour": [
                "0.00442177",
                "0.00444214",
                "0.00437894",
                "0.00444291",
                "0.00440453",
                "0.00441570",
                "0.00454127",
                ...
            ]
        }
    }
    

    GET /0x/markets/[marketId]/fills

    Retrieves a paginated list of order fills for a market, sorted by fill date.

    Parameters

    Query parameters:

    Response

    [
        {
            "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "transactionHash": "0x215ad5f9849b1c26f5bc7f2f99b2f19c0225e9c4093d19163d29c2b5b737dff5",
            "type": "SELL",
            "blockNumber": 7763821,
            "makerAddress": "0xffd99af9f7322e78be8dec497df76ef5c2207e04",
            "takerAddress": "0x409b512e1cf94500877c5353b2a0c13b2d24914f",
            "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
            "makerFeePaid": "0.00000000",
            "takerFeePaid": "0.00000000",
            "filledBaseTokenAmount": "2581.78487402",
            "filledQuoteTokenAmount": "11.41607699",
            "orderHash": "0x9872faf06f4561f74b65ee4e388741f26bfa53120f418203d4ebeb66131ed347",
            "timestamp": 1557908475,
            "outlier": false
        },
        ...   
    ]
    

    GET /0x/markets/[marketId]/book

    Retrieves the order book for a market, containing a list of bids and asks. Both asks and bids are sorted by best price.

    Parameters

    Query parameters:

    Response

    {
        "asks": [
            {
                "orderHash": "0x653a64f3a1c9f62c93de63dc0d0c416c5fe8754418cb32e0d8c29c725037252c",
                "type": "ASK",
                "state": "OPEN",
                "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "remainingBaseTokenAmount": "404.50000000",
                "remainingQuoteTokenAmount": "2.00000000",
                "price": "0.00494437",
                "createdDate": "2019-05-14 08:56:16",
                "signedOrder": {
                    "makerAddress": "0xc0afef712a1341ca78da145b2afad346e8c3574f",
                    "takerAddress": "0x0000000000000000000000000000000000000000",
                    "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
                    "senderAddress": "0x0000000000000000000000000000000000000000",
                    "makerAssetAmount": "404500000000000000000",
                    "takerAssetAmount": "2000000000000000000",
                    "makerFee": "0",
                    "takerFee": "0",
                    "expirationTimeSeconds": "1573725380",
                    "salt": "1557824181190",
                    "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                    "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                    "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
                    "signature": "0x1cfdc76f585b65ef79a217bdfee71e41dd1952cd46cdb346ef8cfdd774102213f511a9069a5f575f17645708ae6fce2b03aba387905b2fb21cd33755e1ce07681b02"
                }
            },
            ...
        ],
        "bids": [
            ...
        ]
    }
    

    GET /0x/orders/[orderHash]

    Retrieves a specific order by order hash.

    Parameters

    Query parameters:

    Response

    Success Response

    {
        "orderHash": "0x653a64f3a1c9f62c93de63dc0d0c416c5fe8754418cb32e0d8c29c725037252c",
        "type": "ASK",
        "state": "OPEN",
        "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
        "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "remainingBaseTokenAmount": "404.50000000",
        "remainingQuoteTokenAmount": "2.00000000",
        "price": "0.00494437",
        "createdDate": "2019-05-14 08:56:16",
        "signedOrder": {
            "makerAddress": "0xc0afef712a1341ca78da145b2afad346e8c3574f",
            "takerAddress": "0x0000000000000000000000000000000000000000",
            "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
            "senderAddress": "0x0000000000000000000000000000000000000000",
            "makerAssetAmount": "404500000000000000000",
            "takerAssetAmount": "2000000000000000000",
            "makerFee": "0",
            "takerFee": "0",
            "expirationTimeSeconds": "1573725380",
            "salt": "1557824181190",
            "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
            "signature": "0x1cfdc76f585b65ef79a217bdfee71e41dd1952cd46cdb346ef8cfdd774102213f511a9069a5f575f17645708ae6fce2b03aba387905b2fb21cd33755e1ce07681b02"
        }
    }
    

    Error Response

    Returns HTTP 400 if an invalid order hash is supplied.

    Returns HTTP 404 if no order with specified order hash was found.

    GET /0x/orders/[orderHash]/validate

    Validates a specific order by order hash.

    Parameters

    Query parameters:

    Response

    Success Response

    Returns HTTP 200 if order is valid.

    Error Response

    Returns HTTP 400 if an invalid order hash is supplied.

    Returns HTTP 404 if no order with specified order hash was found.

    Trade API

    POST /0x/orders

    Submits a signed order to place on the books.

    Payload

    See payload schema

    {
        "makerAddress": "0xc0afef712a1341ca78da145b2afad346e8c3574f",
        "takerAddress": "0x0000000000000000000000000000000000000000",
        "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
        "senderAddress": "0x0000000000000000000000000000000000000000",
        "makerAssetAmount": "404500000000000000000",
        "takerAssetAmount": "2000000000000000000",
        "makerFee": "0",
        "takerFee": "0",
        "expirationTimeSeconds": "1573725380",
        "salt": "1557824181190",
        "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
        "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
        "signature": "0x1cfdc76f585b65ef79a217bdfee71e41dd1952cd46cdb346ef8cfdd774102213f511a9069a5f575f17645708ae6fce2b03aba387905b2fb21cd33755e1ce07681b02"
    }
    

    Response

    Success Response

    Returns a HTTP 201 response with the following payload:

    Order created
    

    Error Response

    Returns a HTTP 400 response with the following payload:

    Invalid input
    

    POST /0x/markets/[marketId]/order/limit

    Submits a limit order request for a specified market. The response that is returned will need to be completed and signed before it is submitted.

    Payload

    {
        "type": "BID",
        "quantity": "1000",
        "price": "0.123",
        "expiration": "1573725380"
    }
    

    Response

    Success Response

    Returns a HTTP 200 response with the following payload:

    {
        "makerAddress": "SET",
        "takerAddress": "0x0000000000000000000000000000000000000000",
        "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
        "senderAddress": "0x0000000000000000000000000000000000000000",
        "makerAssetAmount": "404500000000000000000",
        "takerAssetAmount": "2000000000000000000",
        "makerFee": "0",
        "takerFee": "0",
        "expirationTimeSeconds": "1573725380",
        "salt": "1557824181190",
        "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
        "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
        "signature": "SET"
    }
    

    Error Response

    Returns HTTP 400 for an invalid request.

    Returns HTTP 404 if the market could not be found.

    POST /0x/markets/[marketId]/order/market

    Submits a market order request for a specified market. The response returned will include a list of orders that will fill the market request.

    Payload

    {
        "type": "BID",
        "quantity": "1000",
    }
    

    Response

    Success Response

    {
        "averagePrice": "0.1234",
        "bestPrice": "0.1",
        "worstPrice": "0.2",
        "spread": "0.1",
        "orders": [
            {
                "makerAddress": "0x7aaf591195be109a5664d5f560e2788d5a7a08d7",
                "takerAddress": "0x0000000000000000000000000000000000000000",
                "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
                "senderAddress": "0x0000000000000000000000000000000000000000",
                "makerAssetAmount": "423222022200000000000",
                "takerAssetAmount": "2105582200000000000",
                "makerFee": "0",
                "takerFee": "0",
                "expirationTimeSeconds": "1557926154",
                "salt": "1557839770420",
                "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
                "signature": "0x1c7c1cd8f8a956428c6e56c847a7495e0a04c643074838bdf42048f3769aeb03f354f62d854408ac4fee8ae4b3f91c66e4d74c421f75cf5f8bd206b22019e2be9702"
            },
            ...
        ]
    }
    

    Error Response

    Returns HTTP 400 for an invalid request.

    Returns HTTP 404 if the market could not be found.

    Accounts API

    GET /0x/accounts/[accountAddress]/fills

    Retrieves a list of order fills for an account, sorted by fill date.

    Parameters

    Query parameters:

    Response

    [
        {
            "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "transactionHash": "0x215ad5f9849b1c26f5bc7f2f99b2f19c0225e9c4093d19163d29c2b5b737dff5",
            "type": "SELL",
            "blockNumber": 7763821,
            "makerAddress": "0xffd99af9f7322e78be8dec497df76ef5c2207e04",
            "takerAddress": "0x409b512e1cf94500877c5353b2a0c13b2d24914f",
            "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
            "makerFeePaid": "0.00000000",
            "takerFeePaid": "0.00000000",
            "filledBaseTokenAmount": "2581.78487402",
            "filledQuoteTokenAmount": "11.41607699",
            "orderHash": "0x9872faf06f4561f74b65ee4e388741f26bfa53120f418203d4ebeb66131ed347",
            "timestamp": 1557908475,
            "outlier": false
        },
        ...   
    ]
    

    GET /0x/accounts/[accountAddress]/orders

    Retrieves a list of open orders for an account.

    Parameters

    Query parameters:

    Response

    [
        {
            "orderHash": "0x653a64f3a1c9f62c93de63dc0d0c416c5fe8754418cb32e0d8c29c725037252c",
            "type": "ASK",
            "state": "OPEN",
            "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "remainingBaseTokenAmount": "404.50000000",
            "remainingQuoteTokenAmount": "2.00000000",
            "price": "0.00494437",
            "createdDate": "2019-05-14 08:56:16",
            "signedOrder": {
                "makerAddress": "0xc0afef712a1341ca78da145b2afad346e8c3574f",
                "takerAddress": "0x0000000000000000000000000000000000000000",
                "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
                "senderAddress": "0x0000000000000000000000000000000000000000",
                "makerAssetAmount": "404500000000000000000",
                "takerAssetAmount": "2000000000000000000",
                "makerFee": "0",
                "takerFee": "0",
                "expirationTimeSeconds": "1573725380",
                "salt": "1557824181190",
                "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
                "signature": "0x1cfdc76f585b65ef79a217bdfee71e41dd1952cd46cdb346ef8cfdd774102213f511a9069a5f575f17645708ae6fce2b03aba387905b2fb21cd33755e1ce07681b02"
            }
        },
        ...
    ]
    

    WebSocket API

    WebSocket subscriptions are for recieving order updates made to a particular market.

    Ping / Pong Frames

    The server will send Ping frames once every 30 seconds over a WebSocket connection. It is expected the client connection will respond with a Pong frame, otherwise the connection will be terminated.

    It is advised that the client WebSocket connection also sends periodic Ping frames in order to keep the connection open.

    Endpoints

    wss://rest.bamboorelay.com/0x/ws
    

    Subscribe Request

    Request subscription to a specific market's updates.

    Request Payload

    {
        "type": "SUBSCRIBE",
        "topic": "BOOK",
        "market": "ZRX-WETH",
        "requestId": "123e4567-e89b-12d3-a456-426655440000",
        "networkId": "1"
    }
    

    Subscription Response

    {
        "type": "SUBSCRIBE",
        "topic": "BOOK",
        "market": "ZRX-WETH",
        "requestId": "123e4567-e89b-12d3-a456-426655440000"
    }
    

    WebSocket will return the same payload as recieved, upon a successful subscription.

    WebSocket Messages

    Order Added

    Message emitted when an order has been added to a market.

    {
        "action": "NEW",
        "event": {
            "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "order: {
                "orderHash": "0x653a64f3a1c9f62c93de63dc0d0c416c5fe8754418cb32e0d8c29c725037252c",
                "type": "ASK",
                "state": "OPEN",
                "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "remainingBaseTokenAmount": "404.50000000",
                "remainingQuoteTokenAmount": "2.00000000",
                "price": "0.00494437",
                "createdDate": "2019-05-14 08:56:16",
                "signedOrder": {
                    "makerAddress": "0xc0afef712a1341ca78da145b2afad346e8c3574f",
                    "takerAddress": "0x0000000000000000000000000000000000000000",
                    "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
                    "senderAddress": "0x0000000000000000000000000000000000000000",
                    "makerAssetAmount": "404500000000000000000",
                    "takerAssetAmount": "2000000000000000000",
                    "makerFee": "0",
                    "takerFee": "0",
                    "expirationTimeSeconds": "1573725380",
                    "salt": "1557824181190",
                    "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                    "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                    "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
                    "signature": "0x1cfdc76f585b65ef79a217bdfee71e41dd1952cd46cdb346ef8cfdd774102213f511a9069a5f575f17645708ae6fce2b03aba387905b2fb21cd33755e1ce07681b02"
                }
            }
        },
        "requestId": "123e4567-e89b-12d3-a456-426655440000"
    }
    

    Order Removed

    Message emitted when an order has been removed from a market.

    {
        "action": "REMOVE",
        "event": {
            "reason: "EXPIRED",
            "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "orderType: "ASK",
            "orderHash: "0x197f826c9bcb60b62b0fa7f35a17a8f386fc114e0962c616c13ad05539638628"
        },
        "requestId": "123e4567-e89b-12d3-a456-426655440000"
    }
    

    Order Filled

    Message emitted when an order has been partially or fully filled.

    { 
        "action": "FILL",
        "event": {
            "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
            "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "transactionHash":
            "0x890c51bf180d91d54b55915a0ecb8afa2e4be92b0a8282bc0776ad7cdce48519",
            "type": "BUY",
            "blockNumber": 7764346,
            "makerAddress": "0xffd99af9f7322e78be8dec497df76ef5c2207e04",
            "takerAddress": "0x7727b4eb4ba625c856e9a0eeb30e64dfde5d91ae",
            "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
            "makerFeePaid": "0",
            "takerFeePaid": "0",
            "filledBaseTokenAmount": "0.99999999",
            "filledQuoteTokenAmount": "0.00431114",
            "orderHash":
            "0xf8f88e1283549d94553186438e15719755d29f0bab98597dd72c0c103aa7be69",
            "timestamp": 1557915875,
            "outlier": false,
            "order": { 
                "orderHash":
                "0xf8f88e1283549d94553186438e15719755d29f0bab98597dd72c0c103aa7be69",
                "type": "ASK",
                "state": "CLOSED",
                "baseTokenAddress": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                "quoteTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "remainingBaseTokenAmount": "5098.00000000",
                "remainingQuoteTokenAmount": "21.97819925",
                "price": "0.00431114",
                "createdDate": "2019-05-15 10":37":59",
                "signedOrder": {
                    "makerAddress": "0xc0afef712a1341ca78da145b2afad346e8c3574f",
                    "takerAddress": "0x0000000000000000000000000000000000000000",
                    "feeRecipientAddress": "0xa258b39954cef5cb142fd567a46cddb31a670124",
                    "senderAddress": "0x0000000000000000000000000000000000000000",
                    "makerAssetAmount": "404500000000000000000",
                    "takerAssetAmount": "2000000000000000000",
                    "makerFee": "0",
                    "takerFee": "0",
                    "expirationTimeSeconds": "1573725380",
                    "salt": "1557824181190",
                    "makerAssetData": "0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359",
                    "takerAssetData": "0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                    "exchangeAddress": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
                    "signature": "0x1cfdc76f585b65ef79a217bdfee71e41dd1952cd46cdb346ef8cfdd774102213f511a9069a5f575f17645708ae6fce2b03aba387905b2fb21cd33755e1ce07681b02"
                }
            } 
        },
        "requestId": "123e4567-e89b-12d3-a456-426655440000"
    }