Skip to main content

Base Uniswap API

Need real-time Base Uniswap data or anything from the last ~30 days?

For real-time + last ~30 days, use the Trading cube: Trading.Trades gives you clean, MEV-filtered Base Uniswap swaps with USD price, market cap, and supply on every row across 10 chains in one API. Use the EVM queries on this page for raw per-swap detail or call and event context. An EVM query without a dataset argument runs on the realtime dataset, which holds only the last few days; add dataset: combined or dataset: archive for historical Base Uniswap data.

Bitquery provides Uniswap data through APIs, Streams and Data Dumps.

Filter by factory to exclude forks​

Trade.Dex.ProtocolName records which code a pool runs. Forks of v2 and v3 run the same code, so their trades carry the same uniswap_v2 and uniswap_v3 labels. In Bitquery's trade data for Base on 18 September 2026, pools from more than 100 other factories carried the uniswap_v2 label and more than 30 carried uniswap_v3. They made up about one in five transactions under the first label and one in seven under the second.

To keep only Uniswap's own pools, filter on the contract that owns them, as every example on this page now does.

VersionFilter fieldAddress on Base
v2Trade.Dex.OwnerAddress0x8909dc15e40173ff4699343b6eb8132c65e18ec6
v3Trade.Dex.OwnerAddress0x33128a8fc17869897dce68ed026d694621f6fdfd
v4Trade.Dex.SmartContract0x498581ff718922c3f8e6a244956af099b2652b2b

OwnerAddress is the factory that deployed the pool. A v4 pool has no factory: its OwnerAddress is the zero address, and the PoolManager is its SmartContract. In the Trading cube, filter Pair.Market.Address to the v2 or v3 factory, or Pair.Market.Program to the v4 PoolManager. Addresses are from the official deployments list.

The link in each example's description opens an earlier copy saved in the Bitquery IDE, which may still filter by ProtocolName or use older conditions and time windows. Use the code on this page when you need Uniswap's own pools only.

Stream Base Uniswap trades​

Every query on this page also works as a subscription: change query to subscription and drop the orderBy, since a stream already arrives in block order.

subscription BaseUniswapTrades {
EVM(network: base) {
DEXTrades(
where: {
any: [
{ Trade: { Dex: { OwnerAddress: { in: ["0x8909dc15e40173ff4699343b6eb8132c65e18ec6", "0x33128a8fc17869897dce68ed026d694621f6fdfd"] } } } }
{ Trade: { Dex: { SmartContract: { is: "0x498581ff718922c3f8e6a244956af099b2652b2b" } } } }
]
}
) {
Block {
Time
}
Transaction {
Hash
}
Trade {
Dex {
ProtocolName
SmartContract
}
Buy {
Amount
Buyer
Currency {
Symbol
SmartContract
}
}
Sell {
Amount
Seller
Currency {
Symbol
SmartContract
}
}
}
}
}
}

The two conditions cover the v2, v3 and v4 pools listed above. To narrow to one version, keep only that version's address. For a single pool, use Trade: { Dex: { SmartContract: { is: "<pool>" } } } on v2 and v3, or Trade: { PoolId: { is: "<pool id>" } } on v4. If you have any question on other data points reach out to support

Need zero-latency Base data? Read about our Kafka Streams and Contact us for a Trial.

You may also be interested in:

note

To query or stream data via graphQL outside the Bitquery IDE, you need to generate an API access token.

Follow the steps here to create one: How to generate Bitquery API token ➤

Get Latest Trades on Uniswap v3​

The query below returns the latest DEX trades on Uniswap v3.

query MyQuery {
EVM(dataset: realtime, network: base) {
DEXTrades(
where: { Trade: { Dex: { OwnerAddress: { is: "0x33128a8fc17869897dce68ed026d694621f6fdfd" } } } }
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
}
}
}
}

Get Top Traders of a token on uniswap v3​

This query returns the top traders of a token on the selected network. It ranks Transaction.From, the account that sent each swap, since on a sale Trade.Buyer is the pool or a router. Side.Type describes the counter-side of each trade, so bought sums the rows where Side.Type is sell. PriceAsymmetry: {lt: 0.1} drops trades whose two sides disagree badly on value (PriceAsymmetry reference), which would otherwise inflate the USD totals.

query topTraders($network: evm_network, $token: String) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 100}
where: {Trade: {Currency: {SmartContract: {is: $token}}, Dex: {OwnerAddress: {is: "0x33128a8fc17869897dce68ed026d694621f6fdfd"}}, PriceAsymmetry: {lt: 0.1}}}
) {
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": "0x22af33fe49fd1fa80c7149773dde5890d3c76f3b"
}

OHLC in USD of a Token​

This query retrieves hourly open, high, low and close prices in USD for one token traded on Uniswap v3.

{
EVM(network: base, dataset: realtime) {
DEXTradeByTokens(
orderBy: { descendingByField: "Block_testfield" }
where: {
Trade: {
Currency: {
SmartContract: { is: "0x22af33fe49fd1fa80c7149773dde5890d3c76f3b" }
}
Side: {
Currency: {
SmartContract: {
is: "0x4200000000000000000000000000000000000006"
}
}
Type: { is: buy }
}
PriceAsymmetry: { lt: 0.1 }
Dex: { OwnerAddress: { is: "0x33128a8fc17869897dce68ed026d694621f6fdfd" } }
}
}
limit: { count: 10 }
) {
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
}
}
}

Get trading volume, buy volume, sell volume of a token​

This query returns the traded, buy and sell volume of token 0x22af33fe49fd1fa80c7149773dde5890d3c76f3b on Uniswap v3 over the last 24 hours. PriceAsymmetry: {lt: 0.1} drops mispriced trades, which would otherwise skew the USD sums.

query MyQuery {
EVM(network: base) {
DEXTradeByTokens(
where: {
Trade: {
Currency: {
SmartContract: { is: "0x22af33fe49fd1fa80c7149773dde5890d3c76f3b" }
}
Dex: { OwnerAddress: { is: "0x33128a8fc17869897dce68ed026d694621f6fdfd" } }
PriceAsymmetry: { lt: 0.1 }
}
TransactionStatus: { Success: true }
Block: { Time: { since_relative: { hours_ago: 24 } } }
}
) {
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 } } } }
)
}
}
}

Get top bought tokens on uniswap v3​

This query returns the top bought tokens on Uniswap v3. Buys are the rows where Side.Type, the counter-side, is sell. The PriceAsymmetry filter keeps mispriced trades out of the totals.

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

Get top sold tokens on uniswap v3​

This query returns the top sold tokens on Uniswap v3. Sales are the rows where Side.Type, the counter-side, is buy.

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

Get Metadata of a token​

The query below returns a token's metadata: Name, symbol, SmartContract Address and Decimals.

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

Building with Bitquery and Uniswap API​

Start with the Base Sniper Bot guide to build a working project on these APIs.

Frequently Asked Questions

How do I query Uniswap on Base?

Use EVM.DEXTrades with network base and filter Trade.Dex.OwnerAddress to the v2 factory (0x8909dc15e40173ff4699343b6eb8132c65e18ec6) or the v3 factory (0x33128a8fc17869897dce68ed026d694621f6fdfd), or Trade.Dex.SmartContract to the v4 PoolManager (0x498581ff718922c3f8e6a244956af099b2652b2b). Protocol name filters also return forks.

Can I get OHLC for Uniswap pairs on Base?

Use DEXTradeByTokens interval aggregation or Trading.Trades for recent USD candles.

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.