Skip to main content

Raydium CPMM API

Need real-time Raydium CPMM 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 Raydium CPMM swaps with USD price, market cap, and supply on every row across 10 chains in one API. Use this page when you need historical Raydium CPMM data older than ~30 days, raw per-swap detail, or call / event context.

In this section we will see how to get data on Raydium CPMM trades in real-time. You can check out our Pump Fun docs, Raydium v4 docs and Raydium LaunchPad docs too.

note

Trade Side Account field will not be available as aggregates in Archive and Combined Datasets

Subscribe to Realtime CPMM Trades​

This query subscribes to real-time trades on the Raydium CPMM on the Solana blockchain by filtering using {Program: {Address: {is: "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"}}}:. You can run the query here.

subscription MyQuery {
Solana {
DEXTrades(
where: {Instruction: {Program: {Address: {is: "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"}}}, Transaction: {Result: {Success: true}}}
) {
Instruction {
Program {
Method
}
}
Trade {
Buy {
Amount
Account {
Address
}
Currency {
Name
Symbol
MintAddress
Decimals
Fungible
Uri
}
}
Sell {
Amount
Account {
Address
}
Currency {
Name
Symbol
MintAddress
Decimals
Fungible
Uri
}
}
}
Transaction {
Signature
}
}
}
}

Latest Pool Creation on Raydium CPMM​

The query below returns the latest liquidity pools created on Raydium CPMM. It filters on the CPMM program address CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C and on both pool-creation methods:

  • initialize: a pool created directly, as a top-level instruction (Depth: 0).
  • initializeWithPermission: a pool created through a permissioned path, for example when a Raydium LaunchLab token migrates to CPMM (MigrateToCpswap). It appears as an inner instruction (Depth: 1).

Transaction: {Result: {Success: true}} keeps only pools whose creation succeeded.

Run this query in the IDE

{
Solana {
Instructions(
where: {Instruction: {Program: {Address: {is: "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"}, Method: {in: ["initialize", "initializeWithPermission"]}}}, Transaction: {Result: {Success: true}}}
orderBy: {descending: Block_Time}
limit: {count: 10}
) {
Block { Time Slot }
Transaction { Signature Signer }
Instruction {
Depth
Program { Method AccountNames }
Accounts { Address }
}
}
}
}

Reading the pool accounts​

Program.AccountNames lists the role of each address in Accounts, in the same order: the first name belongs to the first address, and so on. The two methods put the accounts in different positions, so map them by name rather than by index:

Accountinitialize positioninitializeWithPermission position
payer—0
creator01
poolState (the liquidity pool address)34
token0Mint45
token1Mint56
lpMint67
token0Vault, token1Vault10, 1111, 12

token0Mint and token1Mint are the two tokens the liquidity pool trades, and token0Vault and token1Vault hold its reserves.

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.