Raydium DEX API - Solana Trades, Pools, OHLC
In this section, we will see how to get Raydium information using Bitquery APIs.
For gRPC streaming of Raydium DEX trades: Solana gRPC Streams (CoreCast) →
Trade Side Account field will not be available for aggregate queries in Archive and Combined Datasets
New Liquidity Pools Created on Solana Raydium DEX (Using Websocket)
You can subscribe to newly created Solana Raydium liquidity pools using the GraphQL subscription (WebSocket). You can try this GraphQL subscription using this link.
In the results, you can get pool and token details using instructions.
Pool Address
You can find the pool address using the following result: Note that the array index starts from 0. Therefore, it will be the 5th entry.
Instructions -> Instruction -> Accounts[4] -> Address
Token A
You can get the 1st token address using the following result: Note that the array index starts from 0. Therefore, it will be the 9th entry.
Instructions -> Instruction -> Accounts[8] -> Address
Token B
You can get the 2nd token address using the following result.
Instructions -> Instruction -> Accounts[9] ->. Address
You can run the following query at Bitquery IDE.
Click to expand GraphQL query
subscription {
Solana {
Instructions(
where: {
Transaction: { Result: { Success: true } }
Instruction: {
Program: {
Method: { is: "initialize2" }
Address: { is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8" }
}
}
}
) {
Block {
Time
Date
}
Transaction {
Signature
}
Instruction {
AncestorIndexes
CallerIndex
Depth
Data
ExternalSeqNumber
InternalSeqNumber
Index
Accounts {
Address
IsWritable
Token {
Mint
Owner
ProgramId
}
}
CallPath
Logs
Program {
AccountNames
Method
Json
Name
Arguments {
Type
Name
Value {
__typename
... on Solana_ABI_Integer_Value_Arg {
integer
}
... on Solana_ABI_String_Value_Arg {
string
}
... on Solana_ABI_Address_Value_Arg {
address
}
... on Solana_ABI_BigInt_Value_Arg {
bigInteger
}
... on Solana_ABI_Bytes_Value_Arg {
hex
}
... on Solana_ABI_Boolean_Value_Arg {
bool
}
... on Solana_ABI_Float_Value_Arg {
float
}
... on Solana_ABI_Json_Value_Arg {
json
}
}
}
}
}
}
}
}
Pair Creation time for a specific pair
You can use the following query to get the pair creation time for a specific pair on Raydium DEX on Solana. But you need to use keyword query obviously.
You can run this query using this link.
Click to expand GraphQL query
Solana {
Instructions(
where: {Transaction: {Result: {Success: true}}, Instruction: {Program: {Method: {is: "initializeUserWithNonce"}, Address: {is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"}}, Accounts: {includes: {Address: {is: "CSyP9JXCVuVoobWrdtBqQeq7s7VWwNAJ7FFBhLnLFUCE"}}}}}
) {
Block {
Time
}
Transaction {
Signature
}
}
}
}
Get the historical Created pairs on any Solana DEX
This query will return information about the historical created pairs according to the selected date frame. You can find the query here
Click to expand GraphQL query
query{
Solana(dataset: archive) {
DEXTradeByTokens(
where: {
Trade: {
Dex: {
ProtocolFamily: {
is: "Raydium"
}
}
}
}
limit: {
count: 100
}) {
Block {
Date(minimum: Block_Date
selectWhere: {
since: "2024-10-01"
till: "2024-11-01"
})
}
Trade {
Dex {
ProtocolFamily
}
Market{
MarketAddress
}
Currency {
Symbol
MintAddress
}
Side {
Currency {
Symbol
MintAddress
}
}
}
}
}
}
Latest price of a token
You can use the following query to get the latest price of a token on Raydium DEX on Solana.
You can run this query using this link.
Click to expand GraphQL query
{
Solana {
DEXTradeByTokens(
limit: {count: 1}
orderBy: {descending: Block_Time}
where: {Trade: {Dex: {ProgramAddress: {is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"}}, Currency: {MintAddress: {is: "token mint address"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}}
) {
Block {
Time
}
Trade {
Price
PriceInUSD
}
}
}
}