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"
}
Check data here on DEXrabbit.
Get Latest Liquidity for All Pools of a Token
Use this query to get latest liquidity snapshots for all pools where a token appears either on the base side or quote side.
Try the query here
Click to expand GraphQL query
query GetLatestLiquidityForPool {
Solana(dataset: realtime) {
DEXPools(
where: {
Pool: {
Market: {
BaseCurrency: { Name: { not: "" } }
QuoteCurrency: { Name: { not: "" } }
}
}
any: [
{
Pool: {
Market: {
BaseCurrency: {
MintAddress: {
is: "F5tfztTnE4sYsMhZT5KrFpWvHmYSfJZoRjCuxKPbpump"
}
}
}
}
}
{
Pool: {
Market: {
QuoteCurrency: {
MintAddress: {
is: "F5tfztTnE4sYsMhZT5KrFpWvHmYSfJZoRjCuxKPbpump"
}
}
}
}
}
]
Transaction: { Result: { Success: true } }
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount(maximum: Block_Slot)
PostAmountInUSD(maximum: Block_Slot)
}
Base {
PostAmount(maximum: Block_Slot)
PostAmountInUSD(maximum: Block_Slot)
}
}
}
}
}
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 Locked Liquidity of a Pool on Solana
This query retrieves the locked liquidity of a pool on Solana by querying balance updates for a specific pool account owner and currency. The locked liquidity is calculated as twice the balance of WSOL in USD (since pools typically have two tokens locked). You can find the query here.
Click to expand GraphQL query
query MyQuery {
Solana {
BalanceUpdates(
where: {
BalanceUpdate: {
Account: {
Owner: { is: "FPY1pAp1xLq2hihs1Tm2tE2F8VQThXhLBvvZnvdfHCTb" }
}
Currency: {
MintAddress: { is: "So11111111111111111111111111111111111111112" }
}
}
}
orderBy: { descendingByField: "BalanceUpdate_Balance_maximum" }
) {
BalanceUpdate {
Balance: PostBalanceInUSD(maximum: Block_Slot)
Currency {
Name
Symbol
MintAddress
}
}
locked_liquidity: calculate(expression: "$BalanceUpdate_Balance*2")
}
}
}
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
}
}
}
}
}