We are fixing the price at the time of creating pair for our token with BNB by adding liquidity. If the Price of the BNB/BUSD. How can we fetch the current market price and update in our DEX?

Is there is any external APIs to achieve this? I am using the Pancake router contract https://testnet.bscscan.com/address/0xd99d1c33f9fc3444f8101754abc46c52416550d1.

Thanks in advance

2 Answers 2


You can get price of BNB/BUSD using getAmountsOut method

//one WBNB in Wei    
const oneWBNB = '1000000000000000000';
const WBNB = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c';
const BUSD = '0xe9e7cea3dedca5984780bafc599bd69add087d56';
const busdAmount = await routerContract.methods.getAmountsOut(oneBNB, [WBNB, BUSD]).call();
  • Thanks. But If the BNB price increases in market. Is that price will update in this contract? Commented Jul 3, 2021 at 8:53
  • No. You need to write a function to monitor prices changes. This function will check price every N seconds and notify user about new price.
    – M M
    Commented Jul 3, 2021 at 9:58
  • 1
    @M M Is there is any API to monitor price change? Commented Jul 3, 2021 at 10:33

it really depends on the chain but for BNB I'd for sure recommend to check CoinBrain.com. Their API is covering all existing coins on the BNB chain and provide you with the realtime market data (such as market cap, price, volume,...).

I've been using it for my own project and i'm super happy about it. Especially because it's for free. 😁

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.