Accessing price data on "all" decentralized exchanges

We are launching a plugin today for this, it will solve your issues

1 Like

That’s great. Is there anywhere I can read about this plugin, or will a video about it be released?

video coming today (latest tomorrow)

1 Like

Is there any update for when the plugin and video will be released?

This may be the video: https://www.youtube.com/watch?v=5MlTnoBm7YQ&ab_channel=MoralisWeb3

That video is about the fiat gateway plugin, not the one that will solve my issues.

not done yet, hope to get it out next few days, was a bit too optimistic

2 Likes

Will the plugin include functionality to pass a currency pair (e.g. dai/eth, dai/uni)?

Hi Ivan, is there any update on the release of this price plugin?

We released the plugin

Plugin docs to see all features (get price quotes, swap, get all tokens etc):

Are there any plans to release plugins to access other dex? Ideally I would need access to data from as many dex as possible.

1inch aggregates most DEXes. by using 1inch plugin you use most dexes

Is it possible to access the dex prices individually? e.g. if I specifically wanted the uniswap or bancor price?

1 Like

Hey @b7011343 :grinning:

If you look at the documentation that Ivan posted, you will find the function:

async function getQuote() {
  const quote = await Moralis.Plugins.oneInch.quote({
    chain: 'bsc', // The blockchain you want to use (eth/bsc/polygon)
    fromTokenAddress: '0x0da6ed8b13214ff28e9ca979dd37439e8a88f6c4', // The token you want to swap
    toTokenAddress: '0x6fd7c98458a943f469e1cf4ea85b173f5cd342f4', // The token you want to receive
    amount: 1000,
  });
  console.log(quote);
}

You can try to specify protocols option:

async function getQuote() {
  const quote = await Moralis.Plugins.oneInch.quote({
    chain: 'bsc', // The blockchain you want to use (eth/bsc/polygon)
    fromTokenAddress: '0x0da6ed8b13214ff28e9ca979dd37439e8a88f6c4', // The token you want to swap
    toTokenAddress: '0x6fd7c98458a943f469e1cf4ea85b173f5cd342f4', // The token you want to receive
    amount: 1000,
    protocols: ""
  });
  console.log(quote);
}

Protocols list you can find on 1 inch swagger by calling this API:

3 Likes

Let me know how it will work for you :raised_hands:

1 Like

not individually - you get the best price across all exchanges

EDIT: I see @Yomoo posted about protocols variable, it may be able to filer exchanges like you want

1 Like

Anyway I’m not sure it is the best solution. Beacuse it’s more for specifying swap routing and not for fetching prices @b7011343

Is there a better solution you could suggest?

You have really tricky case. If you want to create arbitrage bot I don’t think that using not on-chain data is a good idea. You will probably need to call prices from the smart contracts at least to check the information received from the api. And it should be really fast. Speed is important to successful arbitrage. So the most convenient solution is to use a custom smart contract and get only on-chain data

1 Like

Ok I will look into this. If I do it this way I imagine I will need to implement the logic for each dex individually.