diff --git a/docs/blockchain/Solana/solana-geckoterminal-api.md b/docs/blockchain/Solana/solana-geckoterminal-api.md
index e5dbd9d7..5805f6bf 100644
--- a/docs/blockchain/Solana/solana-geckoterminal-api.md
+++ b/docs/blockchain/Solana/solana-geckoterminal-api.md
@@ -1,16 +1,28 @@
---
sidebar_position: 1
-title: "GeckoTerminal Solana API"
-description: "GeckoTerminal Solana API: query and stream Solana on-chain data with Bitquery GraphQL examples for developers. Works with WebSocket live subscriptions."
+title: "GeckoTerminal-style Solana API: Pair Trades, Buys, Sells, Makers, Top Pairs"
+sidebar_label: "GeckoTerminal Solana"
+description: "GeckoTerminal-style Solana pool data with Bitquery GraphQL: live pair trades, buys, sells, makers and volume, 1-minute candles, pool reserves, and top pairs."
+keywords:
+ - GeckoTerminal Solana API
+ - Solana pool trades API
+ - Solana buys sells makers API
+ - Solana pair OHLC API
+ - GeckoTerminal alternative API
---
-# GeckoTerminal Solana API
+import VideoPlayer from "../../../src/components/videoplayer.js";
+import FAQ from "@site/src/components/FAQ";
+
+# GeckoTerminal-style Solana API: Pair Trades, Buys, Sells, Makers, Top Pairs
+
+A GeckoTerminal pool page is a handful of numbers over one market: the trades scrolling in, buys against sells, how many wallets made them, the volume, the candles and the reserves. Each of those is one Bitquery query over the Solana `DEXTradeByTokens` and `DEXPools` cubes, filtered on the pool's market address, and the same queries cover every Solana DEX Bitquery indexes. The worked pool is the WSOL/USDC Orca Whirlpool at `Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE`, one of the busiest markets on the chain, so every example returns rows at any hour. Every example runs in the [IDE](https://ide.bitquery.io) on a free account; Solana queries go to the `eap` endpoint. The [EVM version](/docs/blockchain/Ethereum/dextrades/evm-geckoterminal-api/) covers Ethereum and the other EVM chains.
## Recommended: Trading API queries (real-time + last ~30 days)
### Live trades with USD price, market cap and supply
-Streams MEV-filtered trades across all 9 chains — add `Network: {is: "Solana"}` inside `Pair.Market` to scope to one chain. Run it [in the IDE](https://ide.bitquery.io/Trading-API-Live-Trades-All-Chains).
+Streams MEV-filtered trades across all 9 chains; add `Network: {is: "Solana"}` inside `Pair.Market` to scope to one chain. Run it [in the IDE](https://ide.bitquery.io/Trading-API-Live-Trades-All-Chains).
```graphql
subscription {
@@ -34,7 +46,7 @@ subscription {
### Most accurate token price with 1-minute OHLC (top market)
-Returns the token's price from its top-volume market via `Ranking: { Position: { eq: 1 } }` — swap the token address and network for your token. Run it [in the IDE](https://ide.bitquery.io/Trading-API-Token-Price-Top-Market-Rank-1).
+Returns the token's price from its top-volume market via `Ranking: { Position: { eq: 1 } }`; swap the token address and network for your token. Run it [in the IDE](https://ide.bitquery.io/Trading-API-Token-Price-Top-Market-Rank-1).
```graphql
{
@@ -60,56 +72,36 @@ Returns the token's price from its top-volume market via `Ranking: { Position: {
}
```
-The chain-level queries below remain the right tool for **history older than ~30 days** and per-pool detail.
-
-Everything you see on the GeckoTerminal Solana dashboard—live pairs, trades, prices, volumes, makers/buyers/sellers, and more—can be accessed via APIs/Streams with Bitquery.
-We expose the same on-chain data via GraphQL APIs, real-time WebSocket streams, and enterprise Kafka topics, with optional cloud connectors (AWS, GCP, Snowflake) for analytics pipelines.
-
-Checkout our [GeckoTerminal EVM API documentation](/docs/blockchain/Ethereum/dextrades/evm-geckoterminal-api/) if you are interested in getting EVM chains(Ethereum, Binance Smart Chain(BSC), Arbitrum, Base, Matic, Optimism, etc) data which GeckoTerminal shows.
-
-## Bitquery Solana Data Access Options
-
-- **GraphQL APIs**: Query historical and real-time Solana data with flexible filtering and aggregation
-- **Real-time Streams**: Subscribe to live Solana blockchain events via WebSocket subscriptions
-- **Cloud Solutions**: Access Solana data through AWS, GCP, and Snowflake integrations
-- **Kafka Streams**: High-throughput data streaming for enterprise applications
-
-import VideoPlayer from "../../../src/components/videoplayer.js";
-
-## Getting Started with Solana
-
-- **[Solana API Examples](/docs/blockchain/Solana/)** - Complete collection of Solana API examples
-- **[Solana DEX Trades](/docs/blockchain/Solana/solana-dextrades)** - Real-time DEX trading data and analytics
-- **[Solana Subscriptions](/docs/subscriptions/subscription)** - Learn how to set up real-time data streams
-- **[IDE for Solana](https://ide.bitquery.io)** - Interactive development environment for testing Solana queries
-
-This guide shows how to retrieve the same Solana DEX data that GeckoTerminal displays—real-time trades, pair stats, volumes, buyers/sellers, and more—using Bitquery APIs, streams, and Kafka.
+The chain-level queries below are the tool for history older than about 30 days and for per-pool detail.
-## Get Trade Transactions of GeckoTerminal for a particular pair in realtime
+## Live trades of a pool
-The query will subscribe you to real-time trade transactions for a Solana pair, providing a continuous stream of data as new trades are processed and recorded.
-You can find the query [here](https://ide.bitquery.io/Get-Solana-pair-trades-data-just-like-geckoTerminal_1)
+Filter `Trade.Market.MarketAddress` and put the token you want priced under `Trade.Currency`. Each message is one swap with the amount, the price in the counter token and in USD, the side and the signer. Saved stream [here](https://ide.bitquery.io/Get-Solana-pair-trades-data-just-like-geckoTerminal_1).
```graphql
-subscription MyQuery {
+subscription {
Solana {
DEXTradeByTokens(
- where: {Trade: {Currency: {MintAddress: {is: "8ha2CTTh7qr74o8jLbsniEdNMxnRpMttsWLwarEmpump"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"}}}, Transaction: {Result: {Success: true}}}
+ where: {
+ Trade: {
+ Market: { MarketAddress: { is: "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE" } }
+ Currency: { MintAddress: { is: "So11111111111111111111111111111111111111112" } }
+ }
+ Transaction: { Result: { Success: true } }
+ }
) {
Block {
Time
}
Trade {
Currency {
- Name
Symbol
}
Amount
- PriceAgainstSideCurrency: Price
+ Price
PriceInUSD
Side {
Currency {
- Name
Symbol
}
Amount
@@ -123,172 +115,201 @@ subscription MyQuery {
}
}
}
-
```
-## Get Buy Volume, Sell Volume, Buys, Sells, Makers, Total Trade Volume, Buyers, Sellers of a specific Token of GeckoTerminal
+## Buys, sells, makers, buyers, sellers and volume of a pool
-The below query gives you the essential stats for a token such as buy volume, sell volume, total buys, total sells, makers, total trade volume, buyers, sellers (in last 5 min, 1 hour) of a specific token.
-You can run the query [here](https://ide.bitquery.io/Buys-Sells-BuyVolume-SellVolume-Makers-TotalTradedVolume-PriceinUSD-for-solana-token-pair00_2)
+The stat block of a pool page in one query: the last hour with a five-minute sub-window on every metric. `Side.Type` names the counter-side of each trade, so WSOL was bought where the side was sold, and wallets are counted by transaction signer. Saved query [here](https://ide.bitquery.io/Buys-Sells-BuyVolume-SellVolume-Makers-TotalTradedVolume-PriceinUSD-for-solana-token-pair00_2).
```graphql
-query MyQuery($token: String!, $side_token: String!, $pair_address: String!) {
- Solana(dataset: realtime) {
+{
+ Solana {
DEXTradeByTokens(
- where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: $token}}, Side: {Currency: {MintAddress: {is: $side_token}}}, Market: {MarketAddress: {is: $pair_address}}}, Block: {Time: {since_relative: {hours_ago: 1}}}}
+ where: {
+ Transaction: { Result: { Success: true } }
+ Trade: {
+ Market: { MarketAddress: { is: "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE" } }
+ Currency: { MintAddress: { is: "So11111111111111111111111111111111111111112" } }
+ }
+ Block: { Time: { since_relative: { hours_ago: 1 } } }
+ }
) {
Trade {
Currency {
- Name
- MintAddress
Symbol
- }
- start: PriceInUSD(minimum: Block_Time)
- min5: PriceInUSD(
- minimum: Block_Time
- if: {Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
- end: PriceInUSD(maximum: Block_Time)
- Dex {
- ProtocolName
- ProtocolFamily
- ProgramAddress
- }
- Market {
- MarketAddress
+ MintAddress
}
Side {
Currency {
Symbol
- Name
- MintAddress
}
}
+ start: PriceInUSD(minimum: Block_Slot)
+ min5: PriceInUSD(minimum: Block_Slot, if: { Block: { Time: { after_relative: { minutes_ago: 5 } } } })
+ end: PriceInUSD(maximum: Block_Slot)
}
- makers: count(distinct: Transaction_Signer)
- makers_5min: count(
- distinct: Transaction_Signer
- if: {Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
- buyers: count(
- distinct: Transaction_Signer
- if: {Trade: {Side: {Type: {is: buy}}}}
- )
- buyers_5min: count(
- distinct: Transaction_Signer
- if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
- sellers: count(
- distinct: Transaction_Signer
- if: {Trade: {Side: {Type: {is: sell}}}}
- )
- sellers_5min: count(
- distinct: Transaction_Signer
- if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
trades: count
- trades_5min: count(if: {Block: {Time: {after_relative: {minutes_ago: 5}}}})
- traded_volume: sum(of: Trade_Side_AmountInUSD)
- traded_volume_5min: sum(
- of: Trade_Side_AmountInUSD
- if: {Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
- buy_volume: sum(
- of: Trade_Side_AmountInUSD
- if: {Trade: {Side: {Type: {is: buy}}}}
- )
- buy_volume_5min: sum(
- of: Trade_Side_AmountInUSD
- if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
- sell_volume: sum(
- of: Trade_Side_AmountInUSD
- if: {Trade: {Side: {Type: {is: sell}}}}
- )
- sell_volume_5min: sum(
- of: Trade_Side_AmountInUSD
- if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
- buys: count(if: {Trade: {Side: {Type: {is: buy}}}})
- buys_5min: count(
- if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
- sells: count(if: {Trade: {Side: {Type: {is: sell}}}})
- sells_5min: count(
- if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
- )
+ trades5m: count(if: { Block: { Time: { after_relative: { minutes_ago: 5 } } } })
+ buys: count(if: { Trade: { Side: { Type: { is: sell } } } })
+ sells: count(if: { Trade: { Side: { Type: { is: buy } } } })
+ makers: uniq(of: Transaction_Signer)
+ makers5m: uniq(of: Transaction_Signer, if: { Block: { Time: { after_relative: { minutes_ago: 5 } } } })
+ buyers: uniq(of: Transaction_Signer, if: { Trade: { Side: { Type: { is: sell } } } })
+ sellers: uniq(of: Transaction_Signer, if: { Trade: { Side: { Type: { is: buy } } } })
+ volumeUsd: sum(of: Trade_Side_AmountInUSD)
+ volumeUsd5m: sum(of: Trade_Side_AmountInUSD, if: { Block: { Time: { after_relative: { minutes_ago: 5 } } } })
+ buyVolumeUsd: sum(of: Trade_Side_AmountInUSD, if: { Trade: { Side: { Type: { is: sell } } } })
+ sellVolumeUsd: sum(of: Trade_Side_AmountInUSD, if: { Trade: { Side: { Type: { is: buy } } } })
+ }
+ }
+}
+```
+
+## One-minute candles for the pool
+
+Thirty one-minute candles with volume and trade count. `PriceAsymmetry` below 0.1 drops trades whose two sides disagree on price.
+
+```graphql
+{
+ Solana {
+ DEXTradeByTokens(
+ where: {
+ Trade: {
+ Market: { MarketAddress: { is: "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE" } }
+ Currency: { MintAddress: { is: "So11111111111111111111111111111111111111112" } }
+ PriceAsymmetry: { lt: 0.1 }
+ }
+ Transaction: { Result: { Success: true } }
+ Block: { Time: { since_relative: { minutes_ago: 30 } } }
+ }
+ limit: { count: 30 }
+ orderBy: { descendingByField: "Block_Timefield" }
+ ) {
+ 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
}
}
}
+```
+
+## Reserves of the pool
+
+The newest `DEXPools` row for the market carries both reserves after the last change, with the quote side in USD.
+
+```graphql
{
- "token":"3B5wuUrMEi5yATD7on46hKfej3pfmd7t1RKgrsN3pump",
- "side_token": "So11111111111111111111111111111111111111112",
- "pair_address": "9uWW4C36HiCTGr6pZW9VFhr9vdXktZ8NA8jVnzQU35pJ"
+ Solana {
+ DEXPools(
+ where: {
+ Pool: { Market: { MarketAddress: { is: "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE" } } }
+ Transaction: { Result: { Success: true } }
+ }
+ orderBy: { descending: Block_Time }
+ limit: { count: 1 }
+ ) {
+ Block {
+ Time
+ }
+ Pool {
+ Dex {
+ ProtocolName
+ }
+ Market {
+ BaseCurrency {
+ Symbol
+ }
+ QuoteCurrency {
+ Symbol
+ }
+ }
+ Base {
+ PostAmount
+ }
+ Quote {
+ PostAmount
+ PostAmountInUSD
+ PriceInUSD
+ }
+ }
+ }
+ }
}
```
-## Get Top Pairs on Solana on GeckoTerminal
+## Top pairs on Solana
-The query will give the top 10 pairs on Solana network in descending order of their total trades happened in their pools in last 1 hour. This query will get you all the data you need such as total trades, total buys, total sells, total traded volume, total buy volume.
-Keep in mind you cannot use this as a websocket subscription becuase aggregate functions like `sum` doesn't work well in `subscription`.
-You can find the query [here](https://ide.bitquery.io/Get-Top-Pairs-on-Solana-on-GeckoTerminal_1)
+The busiest WSOL-quoted markets of the last hour with the numbers a pair list shows. Aggregates only run as queries, so poll this rather than subscribing. Saved query [here](https://ide.bitquery.io/Get-Top-Pairs-on-Solana-on-GeckoTerminal_1).
```graphql
-query MyQuery {
+{
Solana {
DEXTradeByTokens(
- where: {Transaction: {Result: {Success: true}}, Trade: {Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}, Block: {Time: {since_relative: {hours_ago: 1}}}}
- orderBy: {descendingByField: "total_trades"}
- limit: {count: 10}
+ where: {
+ Transaction: { Result: { Success: true } }
+ Trade: {
+ Side: { Currency: { MintAddress: { is: "So11111111111111111111111111111111111111112" } } }
+ }
+ Block: { Time: { since_relative: { hours_ago: 1 } } }
+ }
+ orderBy: { descendingByField: "trades" }
+ limit: { count: 10 }
) {
Trade {
Currency {
Name
- MintAddress
Symbol
- }
- start: PriceInUSD(minimum: Block_Time)
- min5: PriceInUSD(
- minimum: Block_Time
- if: {Block: {Time: {after: "2024-08-15T05:14:00Z"}}}
- )
- end: PriceInUSD(maximum: Block_Time)
- Dex {
- ProtocolName
- ProtocolFamily
- ProgramAddress
+ MintAddress
}
Market {
MarketAddress
}
- Side {
- Currency {
- Symbol
- Name
- MintAddress
- }
+ Dex {
+ ProtocolName
}
+ start: PriceInUSD(minimum: Block_Slot)
+ min5: PriceInUSD(minimum: Block_Slot, if: { Block: { Time: { after_relative: { minutes_ago: 5 } } } })
+ end: PriceInUSD(maximum: Block_Slot)
}
- makers: count(distinct:Transaction_Signer)
- total_trades: count
- total_traded_volume: sum(of: Trade_Side_AmountInUSD)
- total_buy_volume: sum(
- of: Trade_Side_AmountInUSD
- if: {Trade: {Side: {Type: {is: buy}}}}
- )
- total_sell_volume: sum(
- of: Trade_Side_AmountInUSD
- if: {Trade: {Side: {Type: {is: sell}}}}
- )
- total_buys: count(if: {Trade: {Side: {Type: {is: buy}}}})
- total_sells: count(if: {Trade: {Side: {Type: {is: sell}}}})
+ makers: uniq(of: Transaction_Signer)
+ trades: count
+ volumeUsd: sum(of: Trade_Side_AmountInUSD)
+ buyVolumeUsd: sum(of: Trade_Side_AmountInUSD, if: { Trade: { Side: { Type: { is: sell } } } })
+ sellVolumeUsd: sum(of: Trade_Side_AmountInUSD, if: { Trade: { Side: { Type: { is: buy } } } })
+ buys: count(if: { Trade: { Side: { Type: { is: sell } } } })
+ sells: count(if: { Trade: { Side: { Type: { is: buy } } } })
}
}
}
```
+
+
## Video Tutorial
### Get Gecko Terminal Data with Bitquery API and Streams
+
+## Related pages
+
+- [Solana DEX trades API](/docs/blockchain/Solana/solana-dextrades)
+- [GeckoTerminal-style EVM API](/docs/blockchain/Ethereum/dextrades/evm-geckoterminal-api/)
+- [Crypto Trades API](/docs/trading/crypto-trades-api/trades-api)
+- [Solana API hub](/docs/blockchain/Solana/)