Skip to main content

PancakeSwap Infinity API on BNB Chain: Swaps, Pools by PoolId, Prices, Traders

PancakeSwap Infinity keeps all of its pools inside one manager contract on BNB Chain, 0xa0ffb9c1ce1fe56963b0321b32e7a0302114058b, the same singleton design as Uniswap v4. In Bitquery's cubes that means the protocol name pancakeswap_infinity selects the venue, Trade.PoolId selects a pool, and Dex.SmartContract is the manager on every row. Infinity is one of the busiest venues on the chain, and stablecoin pairs such as USDT/KII are among its most traded markets. Every example runs in the IDE on a free account. The worked token is POWER, 0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223, and the worked pool is USDT/KII, PoolId 0xf43fdb854021ddeb41e06ac1d6e5df475197038ba5d3cba147f469a56870cd1b. Bitquery also indexes PancakeSwap v2 and v3 on BNB Chain; those are on the PancakeSwap API page.

Live swaps with USD on every row

The Trading cube streams every Infinity swap with the trader, USD amounts and the token's market cap. Saved stream here.

subscription {
Trading {
Trades(
where: {
Pair: {
Market: { Network: { is: "Binance Smart Chain" }, Protocol: { is: "pancakeswap_infinity" } }
}
}
) {
Block {
Time
}
Side
Trader {
Address
}
Price
PriceInUsd
AmountsInUsd {
Base
Quote
}
Pair {
Currency {
Symbol
}
QuoteCurrency {
Symbol
}
Pool {
Id
}
}
Supply {
MarketCap
}
}
}
}

Latest swaps on Infinity

The chain cube view: what the pool received and paid out, with USD on both sides and the PoolId. Saved query here.

{
EVM(network: bsc) {
DEXTrades(
where: { Trade: { Dex: { ProtocolName: { is: "pancakeswap_infinity" } } } }
limit: { count: 20 }
orderBy: { descending: Block_Time }
) {
Block {
Time
}
Trade {
PoolId
Buy {
Currency {
Symbol
SmartContract
}
Amount
AmountInUSD
PriceInUSD
}
Sell {
Currency {
Symbol
SmartContract
}
Amount
AmountInUSD
}
}
Transaction {
From
Hash
}
}
}
}

The busiest Infinity pools

Group by PoolId over the last day. Each row is one pool with the token, the trade count and USD volume; the single-trade USD cap keeps thin-pool outliers out of the sums.

{
EVM(network: bsc) {
DEXTradeByTokens(
where: {
Trade: {
Dex: { ProtocolName: { is: "pancakeswap_infinity" } }
Side: { AmountInUSD: { lt: "10000000" } }
}
Block: { Time: { since_relative: { hours_ago: 24 } } }
}
orderBy: { descendingByField: "trades" }
limit: { count: 20 }
) {
Trade {
PoolId
Currency {
Symbol
SmartContract
}
Side {
Currency {
Symbol
}
}
}
trades: count
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}

Price of a token on Infinity

The newest DEXTradeByTokens row for the token carries its price in the quote and in USD, plus the pool it traded in. Saved query here.

{
EVM(network: bsc) {
DEXTradeByTokens(
limit: { count: 1 }
orderBy: { descending: Block_Time }
where: {
Trade: {
Currency: { SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } }
Dex: { ProtocolName: { is: "pancakeswap_infinity" } }
}
}
) {
Block {
Time
}
Trade {
Price
PriceInUSD
PoolId
Currency {
Symbol
Name
SmartContract
Decimals
}
Side {
Currency {
Symbol
}
}
}
}
}
}

The same row answers the metadata question, so the saved token metadata query is this one with the price fields removed.

Hourly OHLC in USD

One-hour candles for the last day. PriceAsymmetry below 0.1 drops trades whose two sides disagree on price, which cleans candles on thin pools. Saved query here.

{
EVM(network: bsc) {
DEXTradeByTokens(
orderBy: { descendingByField: "Block_testfield" }
where: {
Trade: {
Currency: { SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } }
Dex: { ProtocolName: { is: "pancakeswap_infinity" } }
PriceAsymmetry: { lt: 0.1 }
}
Block: { Time: { since_relative: { hours_ago: 24 } } }
}
limit: { count: 24 }
) {
Block {
testfield: Time(interval: { in: hours, count: 1 })
}
volume: sum(of: Trade_Amount)
Trade {
high: PriceInUSD(maximum: Trade_PriceInUSD)
low: PriceInUSD(minimum: Trade_PriceInUSD)
open: PriceInUSD(minimum: Block_Number)
close: PriceInUSD(maximum: Block_Number)
}
count
}
}
}

Volume, bought and sold

Totals for the token over a day. Side.Type describes the counter-side of each trade, so the token was bought where the side was sold. Saved query here.

{
EVM(network: bsc) {
DEXTradeByTokens(
where: {
Trade: {
Currency: { SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } }
Dex: { ProtocolName: { is: "pancakeswap_infinity" } }
}
Block: { Time: { since_relative: { hours_ago: 24 } } }
}
) {
trades: count
volume: sum(of: Trade_Amount)
volumeUsd: sum(of: Trade_Side_AmountInUSD)
bought: sum(of: Trade_Amount, if: { Trade: { Side: { Type: { is: sell } } } })
sold: sum(of: Trade_Amount, if: { Trade: { Side: { Type: { is: buy } } } })
}
}
}

Top traders of a token

Rank by Transaction.From, the account that sent the swap, since the manager contract appears as buyer and seller on raw Infinity rows. Saved query here.

{
EVM(network: bsc) {
DEXTradeByTokens(
orderBy: { descendingByField: "volumeUsd" }
limit: { count: 20 }
where: {
Trade: {
Currency: { SmartContract: { is: "0x9dc44ae5be187eca9e2a67e33f27a4c91cea1223" } }
Dex: { ProtocolName: { is: "pancakeswap_infinity" } }
}
Block: { Time: { since_relative: { hours_ago: 24 } } }
}
) {
Transaction {
From
}
trades: count
volumeUsd: sum(of: Trade_Side_AmountInUSD)
bought: sum(of: Trade_Amount, if: { Trade: { Side: { Type: { is: sell } } } })
sold: sum(of: Trade_Amount, if: { Trade: { Side: { Type: { is: buy } } } })
}
}
}

Most bought and most sold tokens on Infinity

One query, sorted on bought for the buy side; sort on sold for the other list. Saved queries: top bought, top sold.

{
EVM(network: bsc) {
DEXTradeByTokens(
orderBy: { descendingByField: "bought" }
limit: { count: 20 }
where: {
Trade: {
Dex: { ProtocolName: { is: "pancakeswap_infinity" } }
Side: { AmountInUSD: { lt: "10000000" } }
}
Block: { Time: { since_relative: { hours_ago: 24 } } }
}
) {
Trade {
Currency {
Symbol
SmartContract
}
}
bought: sum(of: Trade_Side_AmountInUSD, if: { Trade: { Side: { Type: { is: sell } } } })
sold: sum(of: Trade_Side_AmountInUSD, if: { Trade: { Side: { Type: { is: buy } } } })
trades: count
}
}
}

Reserves of a pool

DEXPoolEvents emits the reserves in USD after every change; filter on the PoolId. The BNB Chain liquidity API has the stream form and the other pool queries.

{
EVM(network: bsc) {
DEXPoolEvents(
where: {
PoolEvent: {
Pool: {
PoolId: { is: "0xf43fdb854021ddeb41e06ac1d6e5df475197038ba5d3cba147f469a56870cd1b" }
}
}
}
limit: { count: 5 }
orderBy: { descending: Block_Time }
) {
Block {
Time
}
PoolEvent {
Pool {
CurrencyA {
Symbol
}
CurrencyB {
Symbol
}
}
Liquidity {
AmountCurrencyA
AmountCurrencyAInUSD
AmountCurrencyB
AmountCurrencyBInUSD
}
AtoBPrice
}
}
}
}

Frequently Asked Questions

How do I get PancakeSwap Infinity trades on BNB Chain?

Filter Trade.Dex.ProtocolName on pancakeswap_infinity in DEXTrades or DEXTradeByTokens under EVM(network: bsc), or use the Trading cube with Market Protocol pancakeswap_infinity for swaps with the trader and USD on every row.

Why do all Infinity pools share one contract address?

Infinity keeps every pool inside its manager contract, 0xa0ffb9c1ce1fe56963b0321b32e7a0302114058b. Trade.PoolId identifies the pool; Dex.SmartContract is always the manager.

How do I find the PoolId of a pair?

Group DEXTradeByTokens by Trade.PoolId with one token in Currency and ProtocolName pancakeswap_infinity. Each row is a pool of that token with its counter token and volume.

Is Infinity the same as Uniswap v4 on BNB Chain?

Same singleton design, different protocol and manager. Uniswap v4 on BNB Chain has its own page and PoolManager address; filter ProtocolName uniswap_v4 for it.

How far back does Infinity trade data go?

DEXTrades and DEXTradeByTokens reach history on the archive and combined datasets; the Trading cube keeps about a month; DEXPoolEvents is realtime-only.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.