Getting Started

Build DEX trading directly into your platform with our API and SDK with just 5 lines of code

DEX.AG let's you to build smarter, not harder. Integrate DEX trading directly into your platform without all the work that comes with maintaining the backend code. The DEX.AG API or SDK allows your users to make the best trade from the DEX with the best price all without having to leave your website or application. The source code for our DEX.AG SDK can be found on our Github.

Do you want to license the DEXAG API/SDK to charge commissions? If so contact us directly.

Still not convinced? Check out what we were able to build with just 5 lines of code from the SDK:

Build DEX.AG into your own interface, start by trying cDAI.io, a live app running our SDK.

API Rate Limiting: 120 requests / minute

API

The DEX.AG API provides pricing information for a given trading pair and amount from supported DEXs.

The following DEXes are currently supported:

  • Uniswap

  • Bancor

  • Kyber

  • Radar Relay

  • Eth2Dai ('oasis')

Get the best price and order details for 1 DAI paying with ETH

https://api.dex.ag/trade?from=ETH&to=DAI&fromAmount=1&dex=ag

Get the price and order details from only Uniswap

https://api.dex.ag/trade?from=ETH&to=DAI&fromAmount=1&dex=uniswap

For a full API reference check:

SDK

The DEX.AG SDK provides a set of client-side functions to interact with our API, execute trades with a web3 browser (Metamask, Coinbase Wallet, etc.), validate the clients' web3 statuses (balance, wrapping ETH, token allowance, mining tracking, etc.)

Example: Buy 1 DAI with ETH

import DEXAG from 'dexag-sdk';
const sdk = DEXAG.fromProvider(window.ethereum);
// receive status messages as the client executes the trade
sdk.registerStatusHandler((status, data)=>{
console.log(status, data)
});
// get trade
const tx = await sdk.getTrade({to: 'DAI', from: 'ETH', toAmount: 1, dex: 'ag'});
// checkout
const valid = await sdk.validate(tx);
if (valid) {
// transaction data is valid, make a trade
sdk.trade(tx);
}

For a full SDK reference check:

Contents
API
SDK