Trade

Get trade details for a given trading pair and amount
/trade
/trade
https://api-v2.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

marketImpact

This contains the marketImpact of a trade which represents how the price for the current trade is compared to the current market price for this trade, expressed as a percentage.

For example, example, if marketImpact = 5, the trade is executing at 5% above the market price.

gasPrice

Max allowed gas price for exchanges with a gas price cap, e.g. Bancor. Note: This is NOT the suggested gas price, it's the maximum that the exchange in question will allow.

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