Skip to main content

Pump Fun API

In this document, we will explore several examples related to pump fund data. Additionally, we have the Moonshot API available, and you can access its documentation here.

Top Pump Fun tokens based on Marketcap​

The PumpFun token has a total supply of 1 billion tokens. Therefore, the maximum price is directly related to the market cap, as market cap = Price * 1 billion (for PumpFun).

Here’s the query to retrieve the top tokens based on their price.

{
Solana {
DEXTrades(
limitBy: { by: Trade_Buy_Currency_MintAddress, count: 1 }
orderBy: { descending: Trade_Buy_Price }
where: {
Trade: {
Dex: { ProtocolName: { is: "pump" } }
Buy: {
Currency: {
MintAddress: { notIn: ["11111111111111111111111111111111"] }
}
}
}
Transaction: { Result: { Success: true } }
}
) {
# All pump fun token has 1 billion supply,
# so multiply price * 1 billion to get marketcap
# results are already sorted by price
Trade {
Buy {
Price
PriceInUSD
Currency {
Name
Symbol
MintAddress
Decimals
Fungible
Uri
}
}
}
}
}
}

Pump Fun Trades in Real-Time​

The below query gets real-time information whenever there's a new trade on the Pump.fun including program method called , buy and sell details, details of the currencies involved, and the transaction specifics like signature. You can run the query here

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

Track New Token Creation on Pump Fun​

Get notified about the newly created token and its information on Pump Fun DEX for getting early bird benefits.

Get Pump Program Address and Method​

To run our desired query we need two parameters, that are Program Address and Method Name. To get these parameters, we can run the following query.

query MyQuery {
Solana {
Instructions(
where: { Instruction: { Program: { Name: { is: "pump" } } } }
) {
Instruction {
Program {
Method
Address
}
}
count
}
}
}

Here is the subscription to get the notification of new token creation event on Pump Fun.

subscription {
Solana {
Instructions(
where: {
Instruction: {
Program: { Method: { is: "create" }, Name: { is: "pump" } }
}
}
) {
Instruction {
Accounts {
Address
IsWritable
Token {
Mint
Owner
ProgramId
}
}
Logs
Program {
AccountNames
Address
Arguments {
Name
Type
Value {
... on Solana_ABI_Json_Value_Arg {
json
}
... on Solana_ABI_Float_Value_Arg {
float
}
... on Solana_ABI_Boolean_Value_Arg {
bool
}
... on Solana_ABI_Bytes_Value_Arg {
hex
}
... on Solana_ABI_BigInt_Value_Arg {
bigInteger
}
... on Solana_ABI_Address_Value_Arg {
address
}
... on Solana_ABI_String_Value_Arg {
string
}
... on Solana_ABI_Integer_Value_Arg {
integer
}
}
}
Method
Name
}
}
Transaction {
Signature
}
}
}
}

Get the Creator of a Pump Fun Token​

The below query fetches the details of Token Creator of a specific token CAYFGvtXQ2djbbdJaUgdfLehx5x73i6ugDWTD82fpump. Here you can find saved query.

query MyQuery {
Solana(network: solana) {
Instructions(
where: {Instruction: {Accounts: {includes: {Address: {is: "CAYFGvtXQ2djbbdJaUgdfLehx5x73i6ugDWTD82fpump"}}}, Program: {Name: {is: "pump"}, Method: {is: "create"}}}}
) {
Transaction {
Signer
Signature
}
Instruction {
Accounts {
Address
}
}
}
}
}

Top Token Creators on Pump Fun​

The below query fetches details about token creators filtering using the pump program and create method. The descendingByField: "tokens_count": Orders the results in descending order based on the count of tokens created. You can run the query here

query MyQuery {
Solana(network: solana) {
Instructions(
where: {Instruction: {Program: {Name: {is: "pump"}, Method: {is: "create"}}}}
orderBy: {descendingByField: "tokens_count"}
) {
tokens_count: count
Transaction {
Signer
}
}
}
}

Get OHLC Data of a Token on Pump Fun​

The below query gets OHLC data of the specified Token 66VR6bjEV5DPSDhYSQyPAxNsY3dgmH6Lwgi5cyf2pump for 1 minute time interval for last 10 minutes on Pump Fun DEX. You can run the query here

Note - You can only use this API using query keyword, using this API as subscription will give wrong results because aggregation and interval don't work correctly together in subscription.

query {
Solana {
DEXTradeByTokens(
limit: { count: 10 }
orderBy: { descendingByField: "Block_Timefield" }
where: {
Trade: {
Currency: {
MintAddress: { is: "66VR6bjEV5DPSDhYSQyPAxNsY3dgmH6Lwgi5cyf2pump" }
}
Dex: {
ProgramAddress: {
is: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
}
}
}
}
) {
Block {
Timefield: Time(interval: { in: minutes, count: 1 })
}
volume: sum(of: Trade_Amount)
Trade {
high: Price(maximum: Trade_Price)
low: Price(minimum: Trade_Price)
open: Price(minimum: Block_Slot)
close: Price(maximum: Block_Slot)
}
count
}
}
}

Track Price of a Token in Realtime on Pump Fun​

The below query gets real-time price of the specified Token qXqLE8rNJ5zn4g5E5M6zddyhx5NbtrFqfHaBV4Zpump on the Pump Fun DEX. You can run the query here

subscription MyQuery {
Solana {
DEXTradeByTokens(
orderBy: { descending: Block_Time }
limit: { count: 10 }
where: {
Trade: {
Dex: {
ProgramAddress: {
is: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
}
}
Currency: {
MintAddress: { is: "qXqLE8rNJ5zn4g5E5M6zddyhx5NbtrFqfHaBV4Zpump" }
}
}
Transaction: { Result: { Success: true } }
}
) {
Block {
Time
}
Trade {
Currency {
MintAddress
Name
Symbol
}
Dex {
ProtocolName
ProtocolFamily
ProgramAddress
}
Side {
Currency {
MintAddress
Symbol
Name
}
}
Price
PriceInUSD
}
Transaction {
Signature
}
}
}
}

Get the Top Token Holders of a specific Token​

THis query gives you Top 10 Token Holders for this specific token GuqAC33o88dabjEuh3tx73xSjdLQBRbWSoicgboCpump. The query provides you the top 10 holders addresses and also their balances of this token. You can change the token address in query as per your needs. You can run the query here

query MyQuery {
Solana {
BalanceUpdates(
limit: { count: 10 }
orderBy: { descendingByField: "BalanceUpdate_Holding_maximum" }
where: {
BalanceUpdate: {
Currency: {
MintAddress: { is: "GuqAC33o88dabjEuh3tx73xSjdLQBRbWSoicgboCpump" }
}
}
Transaction: { Result: { Success: true } }
}
) {
BalanceUpdate {
Currency {
Name
MintAddress
Symbol
}
Account {
Address
}
Holding: PostBalance(maximum: Block_Slot)
}
}
}
}

Get the Trading Volume of a specific Token on Pump Fun DEX​

The below query gets the Trading volume of the specified Token HeGMgxcuASNEgGH8pTUBEfb3K4KjgaXwaMK3bs68pump on the Pump Fun DEX in the past 1 hour. You will have to change the time in this Block: { Time: { since: "2024-06-27T06:46:00Z" } } when you try the query yourself. Keep in mind you can use this API only as a query and not a subscription websocket because aggregates don't work with subscription and you will end up getting wrong results. You can run the query here

query MyQuery {
Solana {
DEXTradeByTokens(
where: {
Trade: {
Currency: {
MintAddress: { is: "HeGMgxcuASNEgGH8pTUBEfb3K4KjgaXwaMK3bs68pump" }
}
Dex: { ProtocolName: { is: "pump" } }
}
Block: { Time: { since: "2024-06-27T06:46:00Z" } }
}
) {
Trade {
Currency {
Name
Symbol
MintAddress
}
Dex {
ProtocolName
ProtocolFamily
}
}
TradeVolume: sum(of: Trade_Amount)
}
}
}

Get the Top Traders of a specific Token on Pump Fun DEX​

The below query gets the Top Traders of the specified Token DMHoACmnNwBniSwsFFZKVhs21DHwQaUaDRn998W4vW5V which was launched on pump fun. Keep in mind you can use this API only as a query and not a subscription websocket because aggregates don't work with subscription and you will end up getting wrong results. You can run the query here

query TopTraders {
Solana {
DEXTradeByTokens(
orderBy: { descendingByField: "volume" }
limit: { count: 5 }
where: {
Trade: {
Currency: {
MintAddress: { is: "CowdtFAhTn9CMFtRnYJj5h9ep1Y1EMQj7j7RhH54pump" }
}
}
Transaction: { Result: { Success: true } }
}
) {
Trade {
Dex {
ProtocolName
ProtocolFamily
ProgramAddress
}
Currency {
Symbol
Name
MintAddress
}

Account {
Address
}
}

bought: sum(
of: Trade_Amount
if: { Trade: { Side: { Type: { is: buy } } } }
)
sold: sum(
of: Trade_Amount
if: { Trade: { Side: { Type: { is: sell } } } }
)
volume: sum(of: Trade_Amount)
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}

All tokens created by an address​

To get all pump fun tokens created by address use this query.

query MyQuery {
Solana(network: solana) {
Instructions(
where: {Transaction: {Signer: {is: "DEQV8Lc2JcLpuzETfsCfAozqwjPVVGoXbJk2e32jZy6p"}},
Instruction: {Program: {Name: {is: "pump"}, Method: {is: "create"}}}}
) {
Transaction {
Signer
Signature
}
Instruction {
Accounts {
Address
}
}
}
}
}

Pump Fun Token first and last price​

To check the first and last price to calculate the price change in the last X minutes, use this query. In this query, the from time should be when you need the price change. For example, if you want a price change for the last 10 minutes, then from should be 10 minutes before now.

query PumpFunRecentTrades {
Solana {
DEXTradeByTokens(
limit: {count: 100}
orderBy: {descendingByField: "Trade_lastPrice_maximum"}
where: {Block: {Time: {since: "2024-08-07T06:50:00Z"}},
Trade: {Currency: {Native: false},
Dex: {ProtocolName: {is: "pump"}}}, Transaction: {Result: {Success: true}}}
) {
Trade {
Market {
MarketAddress
}
Currency {
Symbol
Name
MintAddress
}
lastPrice: Price(maximum: Block_Slot)
prePrice: Price(minimum: Block_Slot)
}
}
}
}

Get Pools details for Pump fun token​

To get pool details (Market address) for Pump fun token use this query.

{
Solana {
DEXTradeByTokens(
where: {Trade: {Dex: {ProtocolName: {is: "pump"}}, Currency: {Symbol: {not: ""}, MintAddress: {in: "WqEwHim2ap9jedL79ydUKF2chD3sgLHCVWDocvVpump"}}}}
) {
count
Trade {
Market {
MarketAddress
}
Currency {
MintAddress
Symbol
}
}
}
}
}

Getting Liquidity for Pump fun tokens​

To get Liquidity of tokens, we will get balance of pools for pool tokens. You can check this query.

{
Solana {
BalanceUpdates(
where: {Block: {Time: {since: "2024-06-25T07:00:00Z"}},
BalanceUpdate: {Account: {Token: {Owner: {in: [
"BesTLFfCP9tAuUDWnqPdtDXZRu5xK6XD8TrABXGBECuf",
"62dvmMKAfnt8jSdT3ToZtxAasx7Ud1tJ6xWsjwwhfaEQ",
"73ZzSgNi27V9MdNQYyE39Vs9m1P9ZKgGPCHAJHin5gLd",
"DwPwU1PAjTXtYNYkeR6awYMDBdSEk12npKzJWKbDHMta",
"FJ4P2a2FqaWmqYpBw9eEfWD6cXV3F2qLPHvAA5jozscS",
"6crUHiCoxZsQuxdMAB18VATKrg7ToyTVxt7MbLYmtugu"
]}}},
Currency: {Native: false}}}
) {
BalanceUpdate {
Account {
Token {
Owner
}
Address
}
Currency {
MintAddress
Native
}
PostBalance(maximum: Block_Slot)
}
}
}
}

OHLC price in SOL and USD and Volume​

To get OHLC price in SOL and USD and to get volume use following query.

{
Solana {
DEXTradeByTokens(
orderBy: {ascendingByField: "Block_Time"}
where: {Trade: {Currency: {MintAddress: {is: "HnixX5WvZ67Sdnx5cjyAmWV71GdxFZtYHWyt3d1pump"}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time(interval: {count: 5, in: minutes})
}
Trade {
Dex {
ProtocolName
ProtocolFamily
}
Currency {
Symbol
Name
MintAddress
}
open: Price(minimum: Block_Slot)
close: Price(maximum: Block_Slot)
min: Price(maximum: Trade_Price)
max: Price(minimum: Trade_Price)
closeUsd: PriceInUSD(maximum: Trade_PriceInUSD)
}
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}

Last Pumpfun Trade before Token gradute to Raydium​

You can use following query to get last trade before token graduate to Raydium.

You can also run this query using this link.

{
Solana {
DexPools(
where: {Pool: {Dex: {ProtocolName: {is: "pump"}}, Base: {PostAmount: {eq: "206900000"}}}, Transaction: {Result: {Success: true}}}
) {
Transaction {
Signer
Signature
}
Instruction {
Program {
Method
}
}
Pool {
Base {
ChangeAmount
PostAmount
}
Quote {
ChangeAmount
ChangeAmountInUSD
PostAmount
PostAmountInUSD
Price
PriceInUSD
}
Dex {
ProgramAddress
ProtocolFamily
ProtocolName
}
Market {
BaseCurrency {
Name
Symbol
}
MarketAddress
QuoteCurrency {
Name
Symbol
}
}
}
}
}
}

Video Tutorial on Getting Pump Fun Trades​

Video Tutorial | How to Get the OHLC Data & Price of a Token on Pump Fun DEX in Realtime​

Video Tutorial | How to get Top Token Holders and Trading Volume for a Pump Fun Token​

Video Tutorial | How to get Top Traders of a Token on Solana Pump Fun DEX​