getPrice

API wrapper function to get a list of prices or the price for a single DEX
getPrice
sdk.getPrice({to: '', from: '', toAmount: 1, dex: ''})

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:

sdk.getPrice({to: 'DAI', from: 'ETH', toAmount: 1, dex: 'all'})

Example: Get the price from Aggregator for 1 DAI with ETH:

sdk.getPrice({to: 'DAI', from: 'ETH', toAmount: 1, dex: 'ag'})

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