The Solana blockchain continues to power some of the most dynamic decentralized exchanges (DEXs), with Raydium standing out as a leading automated market maker (AMM) and liquidity provider. For developers, analysts, and DeFi enthusiasts, accessing real-time and historical trading data is essential for informed decision-making. This guide explores how to leverage the Bitquery API to extract critical insights from Raydium, including liquidity pool creation, trade tracking, price discovery, and OHLC data—all without relying on third-party frontends.
By using GraphQL subscriptions and queries via Bitquery’s powerful interface, you can programmatically monitor on-chain activity with precision. Whether you're building analytics dashboards, arbitrage bots, or portfolio trackers, this walkthrough delivers actionable methods to tap into Raydium’s rich data stream.
Retrieve Newly Created Liquidity Pools Using WebSocket
To stay ahead in fast-moving DeFi markets, monitoring newly launched liquidity pools on Raydium gives early visibility into emerging token pairs. You can subscribe to real-time updates using a GraphQL subscription over WebSocket, enabling instant alerts whenever a new pool is created.
👉 Discover live liquidity pool creations as they happen on Solana
Using Bitquery’s IDE, you can run a subscription query that listens for transaction instructions related to Raydium V4 pool initialization. The key fields are nested within the transaction instructions:
- Pool Address: Found at
Instructions -> Instruction -> Accounts[4] -> Address - Token A Address: Located at
Instructions -> Instruction -> Accounts[8] -> Address - Token B Address: Found at
Instructions -> Instruction -> Accounts[9] -> Address
These index positions assume zero-based indexing in the accounts array. Accurate parsing ensures correct identification of token pairs and their associated pool contract.
Why Monitor New Pools?
New pools often signal upcoming trends—whether it's a new meme coin pairing or institutional-grade asset integration. Early detection allows traders and analysts to assess volume buildup, liquidity depth, and potential price movements before broader market awareness.
Fetch Pair Creation Time for Specific Token Pairs
Knowing when a specific trading pair was created adds context to its maturity and trading history. Using a standard GraphQL query (not subscription), you can retrieve the exact timestamp of pair creation on Raydium.
This requires specifying the mint addresses of both tokens in the pair. The result includes block time, transaction ID, and creator wallet—valuable metadata for due diligence and analytics.
Use cases include:
- Validating launch claims by projects
- Backtesting strategies based on pair age
- Filtering out newly created, high-risk pools
Ensure your query uses the query keyword explicitly, as aggregate functions do not work reliably under WebSocket subscriptions.
Access Historical Liquidity Pool Data
Beyond real-time monitoring, historical analysis is vital for pattern recognition and performance benchmarking. A dedicated query allows retrieval of all pairs created within a defined date range.
You can filter results by:
- Date intervals (hourly, daily, weekly)
- Specific tokens or projects
- Minimum initial liquidity thresholds
This historical dataset supports deeper research into:
- Growth trends of Raydium versus other Solana DEXs
- Seasonality in pool creation
- Correlation between market cycles and new pair launches
👉 Analyze historical trading patterns with powerful on-chain data tools
Get the Latest Price of a Token on Raydium
Price discovery is fundamental in any trading environment. On Raydium, the latest traded price of a token can be obtained by fetching the most recent swap event involving that token.
The method involves:
- Filtering trades by token mint address
- Sorting by block timestamp (descending)
- Extracting the price from input/output amounts
If you limit the result to one record (limit: 1), the output effectively becomes the current market price derived from actual trades—ideal for price feeds or alert systems.
This approach avoids reliance on potentially manipulated oracle prices and instead reflects true market activity.
Stream Real-Time Trades on Raydium DEX
For applications requiring live updates—such as trading bots or live dashboards—subscribing to real-time trade events via WebSocket is optimal.
A GraphQL subscription delivers every trade executed on Raydium as it occurs, including:
- Trader wallet address
- Input/output token amounts
- Transaction fee
- Block timestamp
You can also narrow the stream to trades involving a specific currency by filtering on its mint address. For example, tracking only $RAY token swaps helps monitor its trading volume and sentiment in real time.
This capability powers:
- Arbitrage detection across DEXs
- Real-time volume dashboards
- Anomaly detection for wash trading
Retrieve OHLC Data for Any Token Pair
Candlestick charts are indispensable for technical analysis. With Bitquery’s Raydium OHLC API, you can generate Open, High, Low, and Close prices over customizable time intervals (e.g., 5m, 1h, 1d).
Important: Use this endpoint as a query, not a subscription, because aggregations and time buckets are incompatible with live WebSocket streams.
Each candle includes:
- Volume in both tokens
- Number of trades
- Liquidity context
This structured format enables integration with charting libraries like Chart.js or TradingView for professional-grade visualizations.
Track Add Liquidity Transactions in Real Time
Liquidity additions signal confidence from market makers and large holders. Monitoring these events helps identify growing interest in specific pools.
To detect add liquidity actions:
- Identify the correct program instruction—found to be
setPositionStopLossafter analyzing Raydium V4 methods. - Subscribe to transactions invoking this method.
- Parse token mints from the 7th and 8th entries in the
Accountsarray: these represent Token A and Token B respectively.
Sudden spikes in liquidity inflows may precede price rallies or major announcements.
Monitor Remove Liquidity Events
Conversely, tracking liquidity removals—triggered by the setPositionRangeStop method—can reveal potential exit signals or market uncertainty.
Similar to add events:
- Use WebSocket to listen for
setPositionRangeStopcalls - Extract token addresses from account indices 7 and 8
- Aggregate outflows over time to detect trends
A sustained wave of withdrawals could indicate declining trust or rebalancing ahead of volatility.
Understand OpenBook-Enabled DEX Trades
Raydium integrates OpenBook, an order book protocol layered on top of its AMM system. This hybrid model supports limit orders and advanced trading features.
You can track Raydium DEXTrades powered by OpenBook using a dedicated WebSocket API. These trades differ from standard AMM swaps and include order-type metadata.
Use this data to:
- Compare execution quality between AMM and order book trades
- Study slippage and fill rates
- Build order flow analytics
For full technical clarity, refer to educational content explaining how OpenBook enhances Raydium’s functionality.
Frequently Asked Questions
Q: Can I use these APIs for commercial applications?
A: Yes, Bitquery APIs support commercial use cases including analytics platforms, trading algorithms, and financial reporting tools.
Q: Is there a rate limit on WebSocket subscriptions?
A: Yes, ensure compliance with Bitquery’s usage policies. Consider batching requests or using filters to stay within limits.
Q: How accurate is the price data retrieved?
A: Prices are derived from actual on-chain trades, making them highly accurate representations of market activity at the time of execution.
Q: Can I filter trades by wallet address?
A: Yes, you can include wallet address filters in your queries to track specific users or detect whale activity.
Q: What tokens can I monitor?
A: Any SPL token listed on Raydium can be monitored—just provide its mint address in your query parameters.
Q: Do I need coding experience to use these APIs?
A: Basic knowledge of GraphQL and JSON parsing is recommended. However, Bitquery IDE offers templates to simplify adoption.
👉 Unlock advanced trading insights with real-time blockchain data