PancakeSwap API — Top 6 PancakeSwap API Providers

Sheila Karen Dev
Coinmonks
6 min readDec 4, 2023

--

PancakeSwap is a global decentralized exchange built on the Binance Smart Chain (BSC). Users use it to swap tokens, say from Bitcoin to Cake, BNB, or any other crypto token. Using the PancakeSwap API, developers are able to query the exchange and provide specific information about transactions or tokens on the exchange. Therefore, it is important to know about the top PancakeSwap API providers.

The Top 6 PancakeSwap API Providers

PancakeSwap API providers help developers build applications at cheaper costs. The API providers eliminate the high cost of blockchain data indexing and blockchain complexities. This allows developers to build simple applications too.

Blockchain indexing requires a team of highly skilled developers to maintain the database, infrastructure, and storage. It also requires a team of cryptocurrency experts with in-depth knowledge of data exchange on different chains.

Hence, many developers prefer using API providers that provide indexed blockchain data, which reduces efforts to maintain the infrastructure and cost associated with it.

Here are the Top PancakeSwap API providers, which we will discuss in-depth below:

Bitquery

Image Source: Bitquery Official Website

Bitquery is the most popular data API provider for PancakeSwap. Bitquery provides real-time and historical indexed blockchain data for 40+ blockchains, including Binance Smart Chain (BSC). It provides data for several things like blockchain transactions, token transfers, NFTs, the latest trading pairs, newly listed tokens, etc. DEX Trades API is best for delivering trading-related data from DEXs like PancakeSwap. DEX Trades represent all token swaps on decentralized exchanges. In a trade, there is always the buyer and the seller.

Bitquery’s DEX Trades API gives trading data from different DEXs, for example, PancakeSwap or Uniswap. It provides real-time and historical trade information for tokens. To query PancakeSwap using the DEX Trades API, you can use two options: a DEX trades or DEX trades by tokens.

Here is an example of a query for DEX Trades on BSC,

{
ethereum(network: bsc) {
dexTrades(
date: {since: "2022-10-10"}
baseCurrency: {in: "0x7789A798dd9f075cbe58A7bfC368a153164a919f"}
) {
trades: count
baseCurrency {
name
address
}
}
}
}

You can also get newly listed tokens on PancakeSwap using Bitquery’s PancakeSwap API. To get the information, use the Latest Pair Created on PancakeSwap query. Here is an example of the query,

{
ethereum(network: bsc) {
arguments(
options: {desc: ["block.height","index"], limit: 10}
smartContractAddress: {in: "0xbcfccbde45ce874adcb698cc183debcf17952812", }
smartContractEvent: {is: "PairCreated"}
) {
block {
height
}
index
pair: any(of: argument_value, argument: {is: "pair"})
token0: any(of: argument_value, argument: {is: "token0"})
token0Name: any(of: argument_value, argument: {is: "token0"}, as: token_name)
token1: any(of: argument_value, argument: {is: "token1"})
token1Name: any(of: argument_value, argument: {is: "token1"}, as: token_name)
}
}
}

Bitquery’s API also allows you to get the balance of a Binance cold wallet,

query {
ethereum(network: bsc) {
address(address: {is: "0x3c783c21a0383057D128bae431894a5C19F9Cf06"}) {
balance(in: USD)
balances(
currency: {in: ["0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82"]}
) {
currency {
address
name
symbol
}
value(in: USD)
}
}
}
}

For NFTs, Bitquery allows you to find the top 10 NFT holders. Using the Top Holders of PancakeSquad, you are able to query the PancakeSquad NFT Collection on BSC and find the top 10 balance updates for each contract address.

You can also query transactions on PancakeSwap after a certain time limit. The query below allows you to query every transaction for 1 hour without any interruption.

query ($network: EthereumNetwork!, $from: ISO8601DateTime, $till: ISO8601DateTime) {
ethereum(network: $network) {
dexTrades(
options: {asc: "date.date", offset: 10, limit: 10}
date: {since: $from, till: $till}
exchangeName: {is: "Pancake v2"}
sellCurrency: {notIn: ["USDT", "WBNB", "BUSD", "USDC"]}
) {
buyCurrency {
name
symbol
}
sellCurrency {
name
symbol
}
date {
date
}
buyAmount(in: USD)
last_price: maximum(of: block, get: price)
median_price: price(calculate: median)
block {
timestamp {
unixtime
}
}
}
}
}

To get liquidity provisioning amounts to reproduce a problem on PancakeSwap pool use this query.

Using Bitquery’s PancakeSwap API, you can get information about burn and mint events, trades not on the pancake exchange, a copy of Pancake OHLC data, trade history for a specific token, and the total supply of WETH on BSC. All these different queries are in Bitquey’s Search Queries. Be sure to Login first.

NodeReal

Image Source: NodeReal Official Website

NodeReal is another popular PancakeSwap API provider. NodeReal uses GraphQL, just like Bitquery, to provide data to PancakeSwap developers. NodeReal offers better solutions in contrast to PancakeSwap SubGraph API. Because of its architecture, it responds 50 times faster.

Image Source: NodeReal Official Website

According to the official website, “Different from the PancakeSwap Subgraph, NodeReal implements the high-speed PancakeSwap API through the real-time parallel data pipeline. It is a concurrent data indexing engine, and the extractor extracts the data from the chain and saves the data to our database and event handler.

Alchemy

Alchemy is a blockchain provider that queries both BSC and Ethereum. It is very reliable and scalable, making it suitable for both small-scale and large-scale applications. Its wide array of APIs makes data retrieval comprehensive.

Alchemy is a blockchain infrastructure provider offering various services and APIs for various blockchain networks, including Ethereum and Binance Smart Chain (BSC). Alchemy provides a swap function for a pancake pair on the PancakeSwap DEX.

It achieves this using a smart contract, allowing users to swap tokens on the DEX. Using a source code written in solidity, the contract address acts as an API, retrieving and swapping different data. The Pancake Factory Contract is used to create and track existing pairs. It also prevents reentrancy attacks.

Infura

Infura is a fully managed API data provider that ensures developers can interact freely with PancakeSwap. Developers focus on building rather than maintaining infrastructure.

It enables direct querying of PancakeSwap-related data. Additionally, Infura ensures secure access to the PancakeSwap API, providing a convenient and reliable solution for developers. Because PancakeSwap runs on BSC, it is possible to query it using Infura API.

It is important to note that Infura’s BNB Smart Chain API is only available in a private beta release.

Covalent

Covalent has a unified API, which provides a single access point to different blockchains using PancakeSwap. The data provider simplifies complex data into an easy-to-use format. It is suitable for developers who are seeking a unified and straightforward experience.

PancakeSwap SubGraph (The Graph Protocol)

PancakeSwap also provides its own GraphQL API, which offers direct access to specific PancakeSwap data. The APIs are divided into 17 categories (subgraphs), and users use them to query the different blockchains on PancakeSwap.

PancakeSwap, in partnership with The Graph, a popular API provider, offers its API, PancakeSwap Subgraph. It enables developers to index data from PancakeSwap contracts. Using ‘The Graph’ GraphQL’s provider, developers can query data within the BSC Network and PancakeSwap. There are multiple subgraphs, and the architecture allows for additional subgraphs to the repository.

How to Choose the Right PancakeSwap API Provider

The APIs discussed in this article offer users different features and functionalities. To choose the right PancakeSwap API, go through each unique feature, check out the free and beta versions because only a few PancakeSwap APIs are free, and choose one that is easy to integrate with your application.

--

--