DEXResearch

PancakeSwap API – Real-Time Trades, Volume, Liquidity & Pools

Get real-time and historical PancakeSwap trades, volume, liquidity and new pools on BNB Chain, Ethereum and Base, across PancakeSwap v3 and Infinity, with GraphQL queries and streams that run on the current Bitquery API.

Cover Image for PancakeSwap API – Real-Time Trades, Volume, Liquidity & Pools

PancakeSwap is one of the most active DEXs anywhere, and it runs on more than one chain: PancakeSwap v3 and PancakeSwap Infinity on BNB Chain, plus deployments on Ethereum and Base. Below are Bitquery GraphQL queries and subscriptions you can use to pull trades, volume, liquidity signals and pool activity in real time or historically, with no node or custom ETL. Every query was run against the live API before this update; the ones that take variables have a sample variables block underneath.

To call these APIs outside the Bitquery IDE, create an API token first: How to generate a Bitquery API token ➤.

Live PancakeSwap trades with USD on every row

For anything real-time or within the last month, start with the Crypto Trades API. It streams every PancakeSwap swap with the trader, both token legs, a USD price and the token's market cap, MEV-filtered, and one subscription covers BNB Chain, Ethereum and Base by changing the network. This one follows PancakeSwap Infinity on BNB Chain; use pancake_swap_v3 for the v3 pools and bid:base or bid:eth for the other chains. Change subscription to query and add limit and orderBy for a one-off pull.

subscription {
  Trading {
    Trades(
      where: {
        Pair: {
          Market: {
            NetworkBid: { is: "bid:bsc" }
            Protocol: { is: "pancakeswap_infinity" }
          }
        }
      }
    ) {
      Block {
        Time
      }
      Side
      Trader {
        Address
      }
      Pair {
        Token {
          Symbol
        }
        QuoteToken {
          Symbol
        }
        Market {
          Protocol
        }
        Pool {
          Id
        }
      }
      PriceInUsd
      AmountsInUsd {
        Quote
      }
      Supply {
        MarketCap
      }
    }
  }
}

Pool.Id identifies the pool on Infinity, which keeps every pool inside one contract the way Uniswap v4 does. The chain-level queries below add pool addresses, raw amounts and the full archive.

PancakeSwap V3 on Ethereum (EVM)

Latest tradesRun in IDE
Live trades on PancakeSwap V3 (Ethereum) over the last day. Switch network to bsc to query BSC markets.

query LatestTrades {
  EVM(network: eth) {
    DEXTradeByTokens(
      orderBy: {descending: Block_Time}
      limit: {count: 50}
      where: {
        TransactionStatus: {Success: true}
        Trade: {Dex: {ProtocolName: {is: "pancake_swap_v3"}}}
        Block: {Time: {since_relative: {hours_ago: 24}}}
      }
    ) {
      Block { Time }
      Transaction { Hash }
      Trade {
        Dex { OwnerAddress ProtocolFamily ProtocolName }
        AmountInUSD
        Price
        Amount
        Side {
          Type
          Currency { Symbol SmartContract Name }
          AmountInUSD
          Amount
        }
        Currency { Symbol SmartContract Name }
      }
    }
  }
}

Top traded pairs on ETHRun in IDE
Rank pairs by USD volume over the last day and fetch recent prices. The time variables set the reference points for the price-change columns.

query pairs($network: evm_network, $market: String!, $eth: String!, $usdc: String!, $usdt: String!, $weth: String!, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime) {
  EVM(network: $network) {
    DEXTradeByTokens(
      where: {
        TransactionStatus: {Success: true}
        Block: {Time: {since_relative: {hours_ago: 24}}}
        Trade: {
          Success: true
          Dex: {ProtocolName: {is: $market}}
        }
        any: [
          {Trade: {Side: {Currency: {SmartContract: {is: $eth}}}}}
          {Trade: {Side: {Currency: {SmartContract: {is: $usdt}}}, Currency: {SmartContract: {notIn: [$eth]}}}}
          {Trade: {Side: {Currency: {SmartContract: {is: $usdc}}}, Currency: {SmartContract: {notIn: [$eth, $usdt]}}}}
          {Trade: {Side: {Currency: {SmartContract: {is: $weth}}}, Currency: {SmartContract: {notIn: [$eth, $usdc, $usdt]}}}}
          {Trade: {Side: {Currency: {SmartContract: {notIn: [$usdc, $usdt, $weth, $eth]}}}, Currency: {SmartContract: {notIn: [$usdc, $usdt, $weth, $eth]}}}}
        ]
      }
      orderBy: {descendingByField: "usd"}
      limit: {count: 70}
    ) {
      Block { Time(maximum: Block_Time) }
      Trade {
        Currency { Symbol Name SmartContract }
        Side { Currency { Symbol Name SmartContract } }
        price_last: PriceInUSD(maximum: Block_Number)
        price_10min_ago: PriceInUSD(maximum: Block_Number, if: {Block: {Time: {before: $time_10min_ago}}})
        price_1h_ago: PriceInUSD(maximum: Block_Number, if: {Block: {Time: {before: $time_1h_ago}}})
        price_3h_ago: PriceInUSD(maximum: Block_Number, if: {Block: {Time: {before: $time_3h_ago}}})
      }
      dexes: uniq(of: Trade_Dex_OwnerAddress)
      amount: sum(of: Trade_Side_Amount)
      usd: sum(of: Trade_Side_AmountInUSD)
      sellers: uniq(of: Trade_Seller)
      buyers: uniq(of: Trade_Buyer)
      count(selectWhere: {ge: "100"})
    }
  }
}
{
  "network": "eth",
  "market": "pancake_swap_v3",
  "eth": "0x",
  "usdc": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "usdt": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "weth": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "time_10min_ago": "2026-09-03T10:20:00Z",
  "time_1h_ago": "2026-09-03T09:30:00Z",
  "time_3h_ago": "2026-09-03T07:30:00Z"
}

Top traders for a tokenRun in IDE
Find the biggest traders for any token on PancakeSwap V3 (example shows USDC on ETH). Traders are grouped by Transaction.From, the wallet that signed the swap. On this cube Side.Type is the trader's action on the counter-leg, so a sell of the quote token is a purchase of the token; the bought and sold aliases follow that rule.

query topTraders {
  EVM(network: eth) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "volumeUsd"}
      limit: {count: 100}
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"}}
          Dex: {ProtocolName: {is:"pancake_swap_v3"}}
        }
      }
    ) {
      Transaction { From }
      bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      volume: sum(of: Trade_Amount)
      volumeUsd: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

PancakeSwap Infinity on Base

The examples use EURC on Base, which trades against USDC on Infinity. Swap in any token address.

Latest tradesRun in IDE

query MyQuery {
  EVM(dataset: realtime, network: base) {
    DEXTrades(
      where: {Trade: {Dex: {ProtocolName: {is: "pancakeswap_infinity"}}}}
      limit: {count: 10}
      orderBy: {descending: Block_Time}
    ) {
      Transaction { From To }
      Trade {
        Dex { ProtocolName SmartContract }
        Buy { Currency { Name } Price Amount }
        Sell { Amount Currency { Name } Price }
      }
      Block { Time }
    }
  }
}

Latest price for a tokenRun in IDE

query MyQuery {
  EVM(dataset: realtime, network: base) {
    DEXTradeByTokens(
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"}}
          Dex: {ProtocolName: {is: "pancakeswap_infinity"}}
        }
      }
      limit: {count: 10}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Trade {
        Price PriceInUSD Amount AmountInUSD
        Currency { Name Symbol SmartContract }
        Dex { ProtocolName SmartContract }
        Side {
          Amount AmountInUSD
          Currency { Name Symbol SmartContract }
        }
      }
    }
  }
}

Top traders for a tokenRun in IDE

query topTraders($network: evm_network, $token: String) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "volumeUsd"}
      limit: {count: 100}
      where: {
        Trade: {
          Currency: {SmartContract: {is: $token}}
          Dex: {ProtocolName: {is: "pancakeswap_infinity"}}
        }
      }
    ) {
      Transaction { From }
      Trade { Dex { OwnerAddress ProtocolFamily ProtocolName } }
      bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      volume: sum(of: Trade_Amount)
      volumeUsd: sum(of: Trade_Side_AmountInUSD)
    }
  }
}
{
  "network": "base",
  "token": "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"
}

OHLC (price candles)Run in IDE
Hourly candles for EURC quoted in USDC. For pre-aggregated candles down to one second, use the Trading cube query at the end of the BSC section.

{
  EVM(network: base, dataset: realtime) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "Block_bucket"}
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"}}
          Side: {Currency: {SmartContract: {is: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"}}, Type: {is: buy}}
          PriceAsymmetry: {lt: 0.1}
          Dex: {ProtocolName: {is: "pancakeswap_infinity"}}
        }
      }
      limit: {count: 10}
    ) {
      Block { bucket: Time(interval: {in: hours, count: 1}) }
      volume: sum(of: Trade_Amount)
      Trade {
        high: Price(maximum: Trade_Price)
        low: Price(minimum: Trade_Price)
        open: Price(minimum: Block_Number)
        close: Price(maximum: Block_Number)
      }
      count
    }
  }
}

Volume, buy/sell splitsRun in IDE
Totals for the last week. On this cube Side.Type is the trader's action on the counter-leg, so a buy of the quote token is a sale of the token, which is why the aliases are crossed.

query MyQuery {
  EVM(network: base) {
    DEXTradeByTokens(
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"}}
          Dex: {ProtocolName: {is: "pancakeswap_infinity"}}
        }
        TransactionStatus: {Success: true}
        Block: {Time: {since_relative: {days_ago: 7}}}
      }
    ) {
      Trade { Currency { Name Symbol SmartContract Decimals } }
      traded_volume_in_usd: sum(of: Trade_Side_AmountInUSD)
      sell_volume_in_usd: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
      buy_volume_in_usd: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
    }
  }
}

Top bought / sold tokensRun in IDE
Swap orderBy between buy and sell to rank directions.

query timeDiagram($network: evm_network) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "buy"}
      limit: {count: 100}
      where: {Trade: {Dex: {ProtocolName: {is: "pancakeswap_infinity"}}}}
    ) {
      Trade {
        Currency { Symbol Name SmartContract }
        Dex { ProtocolName }
      }
      buy: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
      sell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
    }
  }
}
{
  "network": "base"
}

Token metadataRun in IDE
Fetch name, symbol, decimals, and protocol details.

query MyQuery {
  EVM(network: base, dataset: realtime) {
    DEXTradeByTokens(
      limit: {count: 1}
      orderBy: {descending: Block_Time}
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"}}
          Dex: {ProtocolName: {is: "pancakeswap_infinity"}}
        }
      }
    ) {
      Trade {
        Currency {
          Name Symbol SmartContract ProtocolName HasURI Fungible Decimals
        }
      }
    }
  }
}

PancakeSwap V3 on BSC

The v3 factory on BNB Chain is 0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865, and filtering on it as Dex.OwnerAddress selects PancakeSwap's own pools rather than every pool with the v3 interface. The token examples use CAKE.

Latest tradesRun in IDE

{
  EVM(dataset: realtime, network: bsc) {
    DEXTrades(
      orderBy: [
        {descending: Block_Time}
        {descending: Transaction_Index}
        {descending: Trade_Index}
      ]
      where: {
        TransactionStatus: {Success: true}
        Trade: {Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}}
      }
      limit: {count: 20}
    ) {
      Block { Time Number }
      Transaction { Hash From To Value ValueInUSD }
      Trade {
        Buy {
          Amount AmountInUSD Buyer Seller
          Currency { Decimals Name Symbol SmartContract }
          Price PriceInUSD
        }
        Sell {
          Amount AmountInUSD Buyer Seller
          Currency { Name Symbol SmartContract }
          Price PriceInUSD
        }
        Dex { ProtocolName SmartContract OwnerAddress }
      }
    }
  }
}

Streaming trades (confirmed)Run in IDE
Keep the same owner filter to get real-time trades as they confirm.

subscription {
  EVM(network: bsc) {
    DEXTrades(
      where: {
        TransactionStatus: {Success: true}
        Trade: {Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}}
      }
    ) {
      Block { Time Number }
      Transaction { Hash From To Value ValueInUSD }
      Trade {
        Buy { Amount AmountInUSD Currency { Symbol } Price PriceInUSD }
        Sell { Amount AmountInUSD Currency { Symbol } Price PriceInUSD }
        Dex { ProtocolName SmartContract OwnerAddress }
      }
    }
  }
}

Streaming mempool tradesRun in IDE

subscription {
  EVM(network: bsc, mempool: true) {
    DEXTrades(
      where: {
        TransactionStatus: {Success: true}
        Trade: {Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}}
      }
    ) {
      Block { Time Number }
      Transaction { Hash From To Value ValueInUSD }
      Trade {
        Buy { Amount AmountInUSD Currency { Symbol } Price PriceInUSD }
        Sell { Amount AmountInUSD Currency { Symbol } Price PriceInUSD }
        Dex { ProtocolName SmartContract OwnerAddress }
      }
    }
  }
}

Trades for a specific tokenRun in IDE

{
  EVM(dataset: realtime, network: bsc) {
    DEXTradeByTokens(
      limit: {count: 20}
      orderBy: [
        {descending: Block_Time}
        {descending: Transaction_Index}
        {descending: Trade_Index}
      ]
      where: {
        Trade: {
          Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}
          Currency: {SmartContract: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}}
        }
      }
    ) {
      Block { Time Number }
      TransactionStatus { Success }
      Transaction { Hash From To }
      Trade {
        Amount AmountInUSD Price PriceInUSD Success
        Dex { ProtocolName ProtocolFamily }
        Currency { Name Symbol SmartContract }
        Side {
          Amount AmountInUSD Buyer Seller Type
          Currency { Name Symbol SmartContract }
        }
      }
    }
  }
}

Top traders for a tokenRun in IDE

{
  EVM(network: bsc) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "volumeUsd"}
      limit: {count: 100}
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}}
          Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}
        }
      }
    ) {
      Transaction { From }
      Trade { Dex { OwnerAddress ProtocolFamily ProtocolName } }
      bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      volume: sum(of: Trade_Amount)
      volumeUsd: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

Trading volume, buy volume, sell volumeRun in IDE

query MyQuery {
  EVM(network: bsc) {
    DEXTradeByTokens(
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}}
          Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}
        }
        TransactionStatus: {Success: true}
        Block: {Time: {since_relative: {days_ago: 30}}}
      }
    ) {
      Trade { Currency { Name Symbol SmartContract Decimals } }
      traded_volume_in_usd: sum(of: Trade_Side_AmountInUSD)
      sell_volume_in_usd: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
      buy_volume_in_usd: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
    }
  }
}

Token metadataRun in IDE

query MyQuery {
  EVM(network: bsc, dataset: realtime) {
    DEXTradeByTokens(
      limit: {count: 1}
      orderBy: {descending: Block_Time}
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}}
          Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}
        }
      }
    ) {
      Trade {
        Currency {
          Name Symbol SmartContract ProtocolName HasURI Fungible Decimals
        }
      }
    }
  }
}

OHLC via Trading cubeRun in IDE
Pre-aggregated one-second candles for ETH quoted in USDC on PancakeSwap v3, with moving averages. The Trading root takes no dataset argument in a subscription, so drop it if you stream this.

{
  Trading(dataset: realtime) {
    Pairs(
      where: {
        Price: {IsQuotedInUsd: false}
        Interval: {Time: {Duration: {eq: 1}}}
        Currency: {Id: {is: "bid:eth"}}
        QuoteCurrency: {Id: {is: "usdc"}}
        Market: {Network: {is: "Binance Smart Chain"}, Protocol: {is: "pancake_swap_v3"}}
      }
      limit: {count: 10}
      orderBy: {descending: Interval_Time_End}
    ) {
      Token { Id Symbol Address NetworkBid Network Name }
      QuoteToken { Id Symbol Address Name NetworkBid }
      Interval { Time { Start End Duration } }
      Volume { Usd Quote Base }
      Price {
        IsQuotedInUsd
        Ohlc { Open High Low Close }
        Average { Estimate ExponentialMoving Mean SimpleMoving WeightedSimpleMoving }
      }
    }
  }
}

Price change (24h / 6h / 1h / 5m)Run in IDE
One row per token with the price at each reference point and the percentage change since, computed server-side.

query MyQuery {
  EVM(dataset: combined, network: bsc) {
    DEXTradeByTokens(
      where: {
        Trade: {
          Currency: {SmartContract: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}}
          Dex: {OwnerAddress: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}
        }
        TransactionStatus: {Success: true}
        Block: {Time: {since_relative: {hours_ago: 24}}}
      }
    ) {
      Trade {
        Currency { Name Symbol SmartContract }
        Price_5min_ago: PriceInUSD(minimum: Block_Number, if: {Block: {Time: {since_relative: {minutes_ago: 5}}}})
        Price_1h_ago: PriceInUSD(minimum: Block_Number, if: {Block: {Time: {since_relative: {hours_ago: 1}}}})
        Price_6h_ago: PriceInUSD(minimum: Block_Number, if: {Block: {Time: {since_relative: {hours_ago: 6}}}})
        Price_24h_ago: PriceInUSD(minimum: Block_Number)
        CurrentPrice: PriceInUSD(maximum: Block_Number)
      }
      volume_24h: sum(of: Trade_Side_AmountInUSD)
      Price_Change_5min: calculate(expression: "(($Trade_CurrentPrice - $Trade_Price_5min_ago) / $Trade_Price_5min_ago) * 100")
      Price_Change_1h: calculate(expression: "(($Trade_CurrentPrice - $Trade_Price_1h_ago) / $Trade_Price_1h_ago) * 100")
      Price_Change_6h: calculate(expression: "(($Trade_CurrentPrice - $Trade_Price_6h_ago) / $Trade_Price_6h_ago) * 100")
      Price_Change_24h: calculate(expression: "(($Trade_CurrentPrice - $Trade_Price_24h_ago) / $Trade_Price_24h_ago) * 100")
    }
  }
}

New pools createdRun in IDE

{
  EVM(dataset: realtime, network: bsc) {
    Events(
      orderBy: [
        {descending: Block_Time}
        {descending: Transaction_Index}
        {descending: Log_Index}
      ]
      where: {
        LogHeader: {Address: {is: "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865"}}
        Log: {Signature: {Name: {is: "PoolCreated"}}}
      }
    ) {
      Block { Time Number Hash }
      Transaction { Hash From To }
      Receipt { ContractAddress }
      Arguments { Name Value { ... on EVM_ABI_Address_Value_Arg { address } } }
    }
  }
}

Liquidity add/remove eventsRun in IDE
Filter by Mint (add) or Burn (remove) signatures.

subscription {
  EVM(network: bsc) {
    Events(
      orderBy: [
        {descending: Block_Time}
        {descending: Transaction_Index}
        {descending: Log_Index}
      ]
      where: {
        Log: {Signature: {Name: {is: "Mint"}}}
        Transaction: {To: {is: "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364"}}
      }
    ) {
      Block { Time Number Hash }
      Transaction { Hash From To }
      LogHeader { Address Data }
      Arguments { Name Value { ... on EVM_ABI_Address_Value_Arg { address } } }
    }
  }
}

Latest pool reserves for a pairRun in IDE
Current balances of both tokens held by the CAKE/WBNB pool, from the Balances cube. For reserves with USD values, spot prices and a change stream, use DEXPoolEvents as shown in the liquidity API docs, which work on BSC by changing the network.

{
  EVM(dataset: combined, network: bsc) {
    Balances(
      where: {
        Currency: {
          SmartContract: {in: ["0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"]}
        }
        Balance: {Address: {is: "0xafb2da14056725e3ba3a30dd846b6bbbd7886c56"}}
      }
    ) {
      Balance { Amount(selectWhere: {gt: "0"}) AmountInUSD }
      Currency { Name Symbol SmartContract Decimals }
    }
  }
}

All pairs for a tokenRun in IDE

query pairDexList(
  $network: evm_network
  $base: String
  $time_10min_ago: DateTime
  $time_1h_ago: DateTime
  $time_3h_ago: DateTime
  $time_ago: DateTime
  $owner: String
) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "amount"}
      where: {
        TransactionStatus: {Success: true}
        Trade: {
          Currency: {SmartContract: {is: $base}}
          Side: {Amount: {gt: "0"}}
          Dex: {OwnerAddress: {is: $owner}}
        }
        Block: {Time: {after: $time_ago}}
      }
    ) {
      Trade {
        Currency { Name SmartContract }
        Side { Currency { Name SmartContract } }
        Dex { SmartContract }
        price_last: PriceInUSD(maximum: Block_Number)
        price_10min_ago: PriceInUSD(maximum: Block_Number, if: {Block: {Time: {before: $time_10min_ago}}})
        price_1h_ago: PriceInUSD(maximum: Block_Number, if: {Block: {Time: {before: $time_1h_ago}}})
        price_3h_ago: PriceInUSD(maximum: Block_Number, if: {Block: {Time: {before: $time_3h_ago}}})
      }
      amount: sum(of: Trade_Side_AmountInUSD)
      trades: count
    }
  }
}
{
  "network": "bsc",
  "base": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
  "owner": "0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865",
  "time_10min_ago": "2026-09-03T10:20:00Z",
  "time_1h_ago": "2026-09-03T09:30:00Z",
  "time_3h_ago": "2026-09-03T07:30:00Z",
  "time_ago": "2026-09-02T10:30:00Z"
}

Dex.SmartContract in the result is the pool address, which you can feed into the reserves query above.

Build charts and dashboards quickly

All queries return structured JSON you can drop into charting libraries (TradingView, ECharts, Plotly) or pipe into streams/Kafka for low-latency analytics. Swap network, contract addresses, or protocol names to cover additional PancakeSwap markets across chains. The PancakeSwap API and PancakeSwap Infinity API docs carry more variants, and the DEX API page summarises delivery options.

Related reading

Subscribe to our newsletter

Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.