Simple Fetch Token Price Is Only Fetching from Uni V3 Router

I don’t understand this only grabs from Uniswap V3 Router and Not V2? For example this project only has v2 LP so it comes back as 0. Thank you so much anyon that can help.

from moralis import evm_api

api_key = “ur moralis api”
params = {
“address”: “0x30dcba0405004cf124045793e1933c798af9e66a”,
“chain”: “eth”
}

result = evm_api.token.get_token_price(
api_key=api_key,
params=params,
)

print(result)

Hey @Ludamizcrypto,

You will need to set exchange to uniswap-v2 in order to use other exchanges for price.

your params should look like this instead now

params = {
  "chain": "eth",
  "exchange": "uniswap-v2",
  "address": "0x30dcba0405004cf124045793e1933c798af9e66a"
}

Hope this helps~

OMG it did brother THANK YOU THANK YOU THANK YOU!!! Just for you taking time out of your busy day to help an old Visual Basic Programmer trying to catch up in the world and learn python, solidity etc. means so much to me!!!

I was curious, I am not sure how busy of a person you are or how well rounded you are in programming in general but I have been wanting to find a mentor to speak or someone that would be willing to possibly take donation to help me here and there through my ventures. Right now I am studying every day solidity atm. I am trying to my a simple buy low sell high bot in python to work with sushi swap at the moment with a coin called aEGGS to help me accumulate more of them. I guess this api will also work to look up a token on sushiswap to I just need to find out what to put for “exchange” : “sushiswap-v2”, maybe lol.

thanks in advance bud I am ludamizcrypto on telegram

1 Like

for example this coin aeggs is on suhshi swap only but it is on arbitrium and I have tired every possible way to make this work

from moralis import evm_api

api_key = “Yj1qeAJ9cLByFFQTdSZzgM9VjWfwjovWvo6aX2M1DcSvHDFBC7a0oL6mptrbPoHQ”
params = {
“exchange”: “sushiswap-v2”,
“address”: “0x2e516ba5bf3b7ee47fb99b09eadb60bde80a82e0”,
“chain”: “eth”
}

result = evm_api.token.get_token_price(
api_key=api_key,
params=params,
)

print(result)

I’ve noticed I can look up any contract address that is on ETH on sushi it willl not work…maybe the chain needs to be different IDK???

Hey @Ludamizcrypto,

Unfortunately, we don’t support any DEX for our DEX API in Arbitrum, so that will not work unfortunately.

And appreciate the compliment above, but you don’t need to give me any donation :grinning_face_with_smiling_eyes: Feel free to ask in our forum for free, we’ll help you anytime possible~

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.