Get price data at PancakeSwap

1k Views Asked by At

Hi i've met a problem with getting data from pancakeswap. Are there any endpoinds or subgraph apis or smthing else to get price data from PancakeSwap

I've tried to find endpoints or using weird subgraps but nothing works

I'd like to get price data of every token in pancake

3

There are 3 best solutions below

0
Yoseph Kurnia Soenggoro On

You can use Moralis API to do that, they offer getTokenPrice API that indexes multiple DEXs on multiple chain, one of it is of course Pancakeswap.

You can try it out right here as long as you have the address of the token https://docs.moralis.io/web3-data-api/evm/reference/get-token-price?address=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&chain=bsc&include=percent_change&exchange=pancakeswapv2.

Hope this helps!

Cheers~

You can follow this tutorial to implement the API to get token price either in Python or JS/TS https://docs.moralis.io/web3-data-api/evm/how-to-get-the-price-of-an-erc20-token

P.S. I work at Moralis

1
Lakidjen On

To get price data from PancakeSwap in a React application, you can use various methods, including fetching data from an API or interacting directly with the blockchain using a library like Web3.js. Below, I'll provide an example using Web3.js to fetch price data for a token pair from PancakeSwap on the Binance Smart Chain (BSC).

Please note that you'll need to set up a Web3.js environment and have access to the BSC network to interact with Pancake Swap's smart contracts. You can also use a library like web3-react to simplify Web3 integration in your React app.

0
Gaurav Agrawal On

You can get real-time PancakeSwap data using Bitquery's PancakeSwap API. It can provide real time and historical PancakeSwap trades, prices and liquidity pool details.