xStocks API
Tesla xStock Trades in Real-Time
Below query will give you realtime trades of Tesla xStock (TESLAx). You can run the query here
subscription LatestTrades {
Solana {
DEXTradeByTokens(
where: {
Trade: {
Currency: {
MintAddress: { is: "XsDoVfqeBukxuZHWhdvWHBhgEHjGNst4MLodqsJHzoB" }
}
}
Transaction: { Result: { Success: true } }
}
) {
Block {
Time
}
Transaction {
Signature
}
Trade {
Market {
MarketAddress
}
Dex {
ProtocolName
ProtocolFamily
}
AmountInUSD
PriceInUSD
Amount
Currency {
Name
Symbol
MintAddress
}
Side {
Type
Currency {
Symbol
MintAddress
Name
}
AmountInUSD
Amount
}
}
}
}
}
Latest Price of the Apple xstock
You can use the following query to get the latest price of a Apple xStock on Solana.
You can run this query using this link.
query {
Solana {
DEXTradeByTokens(
limit:{count:1}
orderBy:{descending:Block_Time}
where: {Trade: {Currency: {MintAddress: {is: "XsbEhLAtcf6HdfpFZ5xEMdqW8nfAvcsP5bdudRLJzJp"}}}}
) {
Transaction {
Signature
}
Trade {
AmountInUSD
Amount
Currency {
MintAddress
Name
}
Dex {
ProgramAddress
ProtocolName
}
Price
PriceInUSD
Side {
Account {
Address
}
AmountInUSD
Amount
Currency {
Name
MintAddress
}
}
}
}
}
}
Realtime Price feed of Apple xstock
You can use the following query to get the latest price of a Apple xStock on Solana.
You can run this query using this link.
subscription {
Solana {
DEXTradeByTokens(
where: {Trade: {Currency: {MintAddress: {is: "XsbEhLAtcf6HdfpFZ5xEMdqW8nfAvcsP5bdudRLJzJp"}}}}
) {
Transaction {
Signature
}
Trade {
AmountInUSD
Amount
Currency {
MintAddress
Name
}
Dex {
ProgramAddress
ProtocolName
}
Price
PriceInUSD
Side {
Account {
Address
}
AmountInUSD
Amount
Currency {
Name
MintAddress
}
}
}
}
}
}
Tesla xStock OHLC API
If you want to get OHLC data for any xStock, you can use this api. Only use this API as query and not subscription websocket as Aggregates and Time Intervals don't work well with subscriptions.
{
Solana {
DEXTradeByTokens(
orderBy: {descendingByField: "Block_Timefield"}
where: {Trade: {Currency: {MintAddress: {is: "XsDoVfqeBukxuZHWhdvWHBhgEHjGNst4MLodqsJHzoB"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, PriceAsymmetry: {lt: 0.1}}}
limit: {count: 10}
) {
Block {
Timefield: Time(interval: {in: minutes, count: 1})
}
volume: sum(of: Trade_Side_AmountInUSD)
Trade {
high: PriceInUSD(maximum: Trade_Price)
low: PriceInUSD(minimum: Trade_Price)
open: PriceInUSD(minimum: Block_Slot)
close: PriceInUSD(maximum: Block_Slot)
}
count
}
}
}
Get the Top Traders of the Apple xStock
The below query gets the Top Traders of the Apple xStock XsbEhLAtcf6HdfpFZ5xEMdqW8nfAvcsP5bdudRLJzJp
. Keep in mind you can use this API only as a query and not a subscription websocket because aggregates don't work with subscription and you will end up getting wrong results. You can run the query here
query TopTraders($token: String) {
Solana {
DEXTradeByTokens(
orderBy: {descendingByField: "volume"}
limit: {count: 100}
where: {Trade: {Currency: {MintAddress: {is: $token}}}, Transaction: {Result: {Success: true}}}
) {
Trade {
Account {
Owner
}
Currency{
Name
Symbol
MintAddress
}
Side {
Account {
Address
}
Type
}
}
buyVolume: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
sellVolume: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
volume: sum(of: Trade_Side_AmountInUSD)
}
}
}
{
"token": "XsbEhLAtcf6HdfpFZ5xEMdqW8nfAvcsP5bdudRLJzJp"
}
Get trading volume, buy volume, sell volume of the Meta xStock
This query fetches you the traded volume, buy volume and sell volume of a Meta xStock Xsa62P5mvPszXL1krVUnU5ar38bBSVcWAB6fmPCo5Zu
. Try out the API here.
query MyQuery {
Solana(dataset: combined) {
DEXTradeByTokens(
orderBy: {descendingByField: "traded_volume"}
where: {Block: {Time: {since: "2025-06-20T01:00:00Z"}}, Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: "Xsa62P5mvPszXL1krVUnU5ar38bBSVcWAB6fmPCo5Zu"}}, Side: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}}}}
) {
Trade {
Currency {
Name
MintAddress
Symbol
}
Side {
Currency {
Name
Symbol
MintAddress
}
}
}
traded_volume_USD: sum(of:Trade_Side_AmountInUSD)
traded_volume: sum(of: Trade_Amount)
buy_volume: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
sell_volume: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}