Trade

Get the best price and trade details for a given trading pair and amount
/trade
https://api.dex.ag/trade?from=ETH&to=DAI&fromAmount=1&dex=ag

Parameter

Description

from

The token you want to send (input)

to

The token you want to receive (output)

fromAmount (optional*)

The amount of "from" token you want to send

toAmount (optional*)

The amount of "to" token you want to receive

limitAmount (optional*)

Slippage - The limit of "from" token to still execute the trade

discluded

Dex's to disclude from the aggregator. Eg discluded=bancor

dex

A specific DEX (Uniswap), ag (aggregator)

proxy (optional)

Address of the proxy contract

*Note: either fromAmount or toAmount must be specified.

Response: order details containing the DEX, price, and encoded ABI to pass into the web3 browser to execute via sdk.tradeOrder().

Value

Description

trade

data

Encoded ABI data to execute trade on smart contract function

to

Exchanges contract address

value

ETH required to make a trade

metadata

gasPrice

Suggested gas price from strict exchanges like Bancor

source

(provided in case of dex=best)

dex

DEX containing the best price (eg Uniswap)

price

Price denoted in the "from" token (eg ETH)

query

from

Token symbol

to

Token symbol

toAmount

Swap amount (toAmount / fromAmount)

dex

Description of queried DEXes