DEX.AG
Search…
getPrice
API wrapper function to get a list of prices or the price for a single DEX
getPrice
1
sdk.getPrice({to: '', from: '', toAmount: 1, dex: ''})
Copied!
Value
Description
to
The token you want to receive (Output)
from
The token you want to send (Input)
toAmount
The amount of "to" token you want to receive
fromAmount
The amount of "from" token you want to receive
discluded
Dex's to disclude from the aggregator. Eg discluded=bancor
dex
Specify a DEX instead of searching for the best price ag (aggregator), uniswap, or all (even external sources)
Example: Get the price for 1 DAI with ETH from all exchanges:
1
sdk.getPrice({to: 'DAI', from: 'ETH', toAmount: 1, dex: 'all'})
Copied!
Example: Get the price from Aggregator for 1 DAI with ETH:
1
sdk.getPrice({to: 'DAI', from: 'ETH', toAmount: 1, dex: 'ag'})
Copied!
Response: the price for a single DEX or a list of prices.
Value
Description
price
Price denoted in the "from" token (e.g. ETH)
dex
DEX providing the price (e.g. uniswap, ag)
pair
base
Base token of the trading pair
quote
Quote token of the trading pair
Last modified 1yr ago
Copy link