Skip to main content

Solana DEX Pools API

In this section we will see how to get Solana DEX Pools information using our API.

Get all Liquidity Pools updates on Solana

To get all Liquidity pools updates on solana use this stream.

Click to expand GraphQL query
subscription {
Solana {
DEXPools {
Block {
Time
}
Pool {
Base {
ChangeAmount
PostAmount
Price
PriceInUSD
}
Quote {
ChangeAmount
PostAmount
Price
PriceInUSD
}
Dex {
ProgramAddress
ProtocolFamily
}
Market {
BaseCurrency {
MintAddress
Name
Symbol
}
QuoteCurrency {
MintAddress
Name
Symbol
}
MarketAddress
}
}
}
}
}

Get Tokens which have liquidity over 1 Million USD

You can use the below query to get the tokens which are getting traded and have liquidity over 1 million USD. Try out the query here.

Click to expand GraphQL query
subscription MyQuery {
Solana {
DEXPools(
where: {Pool: {Base: {PostAmountInUSD: {ge: "1000000"}}, Market: {QuoteCurrency: {MintAddress: {in: ["11111111111111111111111111111111", "So11111111111111111111111111111111111111112"]}}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
}
Pool {
Base {
PostAmount
PostAmountInUSD
Price
PriceInUSD
}
Quote{
PostAmount
PostAmountInUSD
}
Market {
MarketAddress
BaseCurrency {
MintAddress
Name
Symbol
}
QuoteCurrency {
Name
MintAddress
Symbol
}
}
Dex {
ProtocolFamily
ProgramAddress
ProtocolName
}
Market {
MarketAddress
BaseCurrency {
MintAddress
Name
Symbol
}
QuoteCurrency {
Name
MintAddress
Symbol
}
}
}
}
}
}

Get All Liquidity Pools info for a particular token

This query will give you the information on all the liquidity pools of a particular token EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm. You can find the query here

Click to expand GraphQL query
query ($token: String) {
Solana {
DEXPools(
orderBy: {descendingByField: "Pool_Quote_PostAmountInUSD_maximum"}
where: {Pool: {Market: {BaseCurrency: {MintAddress: {is: $token}}}}}
) {
Pool {
Market {
QuoteCurrency {
Symbol
Name
MintAddress
}
MarketAddress
}
Dex {
ProtocolFamily
}
Base {
PostAmount(maximum: Block_Slot)
PostAmountInUSD(maximum: Block_Slot)
}
Quote {
PostAmount(maximum: Block_Slot)
PostAmountInUSD(maximum: Block_Slot)
}
}
}
}
}
{
"token": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm"
}

image

Check data here on DEXrabbit.

Latest Price of Token Based on Liqudity

This subscription given below returns the latest and real-time price and other info related to the token, DEX and market for the following token LMFzmYL6y1FX8HsEmZ6yNKNzercBmtmpg2ZoLwuUboU.

Click to expand GraphQL query
subscription {
Solana {
DEXPools(
where: {
Pool: {
Market: {
BaseCurrency: {
MintAddress: { is: "So11111111111111111111111111111111111111112" }
}
}
}
Transaction: { Result: { Success: true } }
}
) {
Block {
Time
}
Pool {
Base {
ChangeAmount
PostAmount
Price
PriceInUSD
}
Dex {
ProgramAddress
ProtocolFamily
}
Market {
BaseCurrency {
MintAddress
Name
Symbol
}
MarketAddress
}
}
}
}
}

Get Latest Liquidity of any Liquidity Pool

This query gets you the liquidity/balance of the Quote Currency WSOL and Base Currency SOLANADOG for this particular pool address BDQnwNhTWc3wK4hhsnsEaBBMj3sD4idGzvuidVqUw1vL. THe liquidity value of the currencies will be in Quote{PostAmount} and Base{PostAmount}. You can find the query here

Click to expand GraphQL query
query GetLatestLiquidityForPool {
Solana(dataset: realtime) {
DEXPools(
where: {
Pool: {
Market: {
MarketAddress: {
is: "HktfL7iwGKT5QHjywQkcDnZXScoh811k7akrMZJkCcEF"
}
}
}
Transaction: { Result: { Success: true } }
}
orderBy: { descending: Block_Slot }
limit: { count: 1 }
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PostAmountInUSD
}
Base {
PostAmount
}
}
}
}
}

Get Top Pools Based on Liquidity

This query retrieves the top liquidity pools on the Solana blockchain, sorted by their total liquidity (PostAmount). The query is filtered for pools that have been active since a specific time period. The results are limited to the top 10 pools based on their liquidity.

Click to expand GraphQL query
query GetTopPoolsByDex {
Solana {
DEXPools(
orderBy: { descending: Pool_Quote_PostAmount }
where: {
Block: { Time: { after: "2024-08-27T12:00:00Z" } }
Transaction: { Result: { Success: true } }
}
limit: { count: 10 }
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolName
ProtocolFamily
}
Quote {
PostAmount
PostAmountInUSD
PriceInUSD
}
Base {
PostAmount
}
}
}
}
}

Liquidity Removal from a Pool for a Token

This query allows you to subscribe to updates on liquidity removal from a specific pool on the Solana network. The subscription is filtered by a particular token, identified by the base currency name or smart contract. It returns information on the amount of liquidity removed and the remaining balance.

Click to expand GraphQL query
{
Solana(network: solana) {
DEXPools(
where: {
Pool: {
Base: { ChangeAmount: { lt: "0" } }
Market: {
BaseCurrency: {
MintAddress: {
is: "7M9KJcPNC65ShLDmJmTNhVFcuY95Y1VMeYngKgt67D1t"
}
}
}
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
ChangeAmount
}
Base {
PostAmount
ChangeAmount
}
}
}
}
}

Pump Fun Pool Liquidity Addition

This query returns the instances where liquidity was added to the pools related to the Pump protocol on Solana.

Click to expand GraphQL query
{
Solana {
DEXPools(
where: {
Pool: {
Dex: { ProtocolName: { is: "pump" } }
Base: { ChangeAmount: { gt: "0" } }
}
Transaction: { Result: { Success: true } }
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
PostAmount
}
}
}
}
}

Pump Fun Pool Liquidity Removal

This query returns the liquidity removal/ token burning instances for the Pump protocol on Solana.

Click to expand GraphQL query
{
Solana {
DEXPools(
where: {
Pool: {
Dex: { ProtocolName: { is: "pump" } }
Base: { ChangeAmount: { lt: "0" } }
}
Transaction: { Result: { Success: true } }
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
PostAmount
}
}
}
}
}

Liquidity Added and Removed by Specific Address

This query returns the events of liquidity addition and liquidity removal by a particular address, which is bgrXcQpyAhQ5MGcew8EB8tbz4oBJ5whahorrobfRVBQ for this example.

Please note that Solana for EAP only has the real time data with archive data for recent 10 hours. It could be possible that the query returns an empty array if the address is not recently active.

Click to expand GraphQL query
query MyQuery {
Solana {
DEXPools(
where: {
Transaction: {
Signer: { is: "bgrXcQpyAhQ5MGcew8EB8tbz4oBJ5whahorrobfRVBQ" }
Result: { Success: true }
}
Pool: { Base: { ChangeAmount: { ne: "0" } } }
}
) {
Pool {
Dex {
ProgramAddress
ProtocolFamily
ProtocolName
}
Market {
BaseCurrency {
Name
MintAddress
Symbol
}
QuoteCurrency {
Name
MintAddress
Symbol
}
}
Base {
ChangeAmount
PostAmount
}
Quote {
ChangeAmount
PostAmount
}
}
Block {
Time
}
}
}
}

Top 10 Liquidity Providers

This query given below, returns the top 10 liquidity providers for a given liquidity pool.

For this example:

  • baseCurrency: 5FGULyTir641wnz7gr2p2kiYYpWboVYE83qos1r9pump
  • quoteCurrency: 11111111111111111111111111111111
Click to expand GraphQL query
query MyQuery {
Solana {
DEXPools(
limit: { count: 10 }
where: {
Pool: {
Market: {
QuoteCurrency: {
MintAddress: {
is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}
}
BaseCurrency: {
MintAddress: { is: "So11111111111111111111111111111111111111112" }
}
}
Base: { ChangeAmount: { gt: "0" } }
}
Transaction: { Result: { Success: true } }
}
orderBy: { descendingByField: "liquidityAdded" }
) {
Transaction {
Signer
}
liquidityAdded: sum(of: Pool_Base_ChangeAmountInUSD)
}
}
}

All Liquidity Events for a Pair

In this section, we will discuss how we can get all the liquidity related changes like liquidity addition and liquidity removal for a specified pair, which is, for this example, given below.

  • baseCurrency: 5FGULyTir641wnz7gr2p2kiYYpWboVYE83qos1r9pump
  • quoteCurrency: 11111111111111111111111111111111

Liquidity Addition Event

This query returns the instances of liquidity addition, that is events where baseCurrencyChange is greater than 0.

Click to expand GraphQL query
{
Solana {
DEXPools(
where: {
Pool: {
Market: {
BaseCurrency: {
MintAddress: {
is: "5FGULyTir641wnz7gr2p2kiYYpWboVYE83qos1r9pump"
}
}
QuoteCurrency: {
MintAddress: { is: "11111111111111111111111111111111" }
}
}
Base: { ChangeAmount: { gt: "0" } }
}
Transaction: { Result: { Success: true } }
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

Liquidity Removal Event

Now, to get the instances of liquidity removal, you can run this query.

Click to expand GraphQL query
{
Solana {
DEXPools(
where: {
Pool: {
Market: {
BaseCurrency: {
MintAddress: {
is: "5FGULyTir641wnz7gr2p2kiYYpWboVYE83qos1r9pump"
}
}
QuoteCurrency: {
MintAddress: { is: "11111111111111111111111111111111" }
}
}
Base: { ChangeAmount: { lt: "0" } }
}
Transaction: { Result: { Success: true } }
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

If the segregation shown above is not required, you can remove the Base{ChangeAmount} filter from either of the query and get the desired result.

Liquidity Events for Raydium Pairs

In this section, we will discover data streams that provides us with the real time events of liquidity addition and liquidity removal for the Radium DEX, which has 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 as the Program Address.

Liquidity addition for Radium Pairs

This subscription returns the real-time liquidity addition event details for the Radium Pairs.

Click to expand GraphQL query
subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"
}
}
Base: { ChangeAmount: { gt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

Liquidity removal for Radium Pairs

This subscription returns the real-time liquidity addition event details for the Radium Pairs.

Click to expand GraphQL query
subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"
}
}
Base: { ChangeAmount: { lt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

Liquidity Events for Orca Whirlpool Pairs

In this section, we will discover data streams that provides us with the real time events of liquidity addition and liquidity removal for the Orca Whirlpool DEX, which has whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc as the Program Address.

Liquidity addition for Orca Whirlpool Pairs

This subscription returns the real-time liquidity addition event details for the Orca Whirlpool Pairs.

Click to expand GraphQL query
subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
}
}
Base: { ChangeAmount: { gt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

Liquidity removal for Orca Whirlpool Pairs

This subscription returns the real-time liquidity addition event details for the Orca Whirlpool Pairs.

Click to expand GraphQL query
subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
}
}
Base: { ChangeAmount: { lt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

Liquidity Events for Meteora Pairs

In this section, we will discover data streams that provides us with the real time events of liquidity addition and liquidity removal for the Meteora DEX, which has Meteora as the Protocol Family.

Liquidity addition for Meteora Pairs

This subscription returns the real-time liquidity addition event details for the Meteora Pairs.

Click to expand GraphQL query
subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: { ProtocolFamily: { is: "Meteora" } }
Base: { ChangeAmount: { gt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

Liquidity removal for Meteora Pairs

This subscription returns the real-time liquidity addition event details for the Meteora Pairs.

Click to expand GraphQL query
subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: { ProtocolFamily: { is: "Meteora" } }
Base: { ChangeAmount: { lt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}