Getting Started

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

DEX.AG lets you 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.

API Rate Limiting: 120 requests / minute

API

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

The following DEXes are currently supported:

  • Uniswap (uniswap)

  • Bancor (bancor)

  • Kyber (kyber)

  • 0x V3 (zero_x)

  • Oasis (oasis)

  • Synthetix (synthetix)

  • Curve (curvefi)

  • Use ag to get the X Blaster price. DEX.AG’s X Blaster feature splits your large trade orders into smaller ones across multiple DEXes to make sure you’re getting the best possible price for your order.

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

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

Get the price and order details from only Uniswap

https://api-v2.dex.ag/price?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