Quick Start Examples
OHLC Stream on a Chain
Mention the chain/network using the Token: {Network}
filter.
Available values: Ethereum
, Solana
, Base
, Optimism
, Opbnb
, Matic
, Arbitrum
, Binance Smart Chain
, Tron
.
The available duration intervals are listed here.
subscription {
Trading {
Tokens(
where: {Token: {Network: {is: "Solana"}}, Interval: {Time: {Duration: {eq: 60}}}}
) {
Token {
Address
Id
IsNative
Name
Network
Symbol
TokenId
}
Block {
Date
Time
Timestamp
}
Interval {
Time {
Start
Duration
End
}
}
Volume {
Base
Quote
Usd
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
}
}
}
OHLC of a Token Pair Across Chains
This subscription fetches real-time OHLC (Open, High, Low, Close) price data for a token pair across different blockchains.
For native tokens, you only need to specify their ID (e.g., bid:eth
for ETH).
subscription {
Trading {
Pairs(
where: {
Price: {IsQuotedInUsd: false}
Interval: {Time: {Duration: {eq: 60}}}
Token: {Address: {is: "0xc0634090f2fe6c6d75e61be2b949464abb498973"}}
QuoteCurrency: {Id: {is: "bid:eth"}}
}
) {
Token {
Id
}
QuoteToken {
Id
}
Currency {
Symbol
}
QuoteCurrency {
Symbol
}
Interval {
Time {
Start
}
}
Volume {
Usd
Quote
BaseQuotedInUsd
}
Price {
Ohlc {
open
High
Low
Close
}
}
}
}
}
Find Price Arbitrage Opportunity of Pair Across Chains
{
Trading {
Pairs(
where: {
Currency: {Id: {is: "bid:bitcoin"}}
QuoteCurrency: {Id: {is: "usdt"}}
}
limit: {count: 10}
orderBy: {descending: Block_Time}
limitBy: {by: Market_Address, count: 1}
) {
Currency {
Name
Id
}
Market {
Name
NetworkBid
Network
Address
}
Price {
IsQuotedInUsd
Average {
Mean
}
}
QuoteCurrency {
Id
Symbol
Name
}
QuoteToken {
Symbol
Name
Id
NetworkBid
Network
Did
Address
}
Token {
Name
Id
NetworkBid
}
}
}
}
5 Minute Price Change API
This stream uses expressions
{
Trading {
Tokens(
limit: {count: 10}
orderBy: {descendingByField: "change"}
where: {
Volume: {Usd: {gt: 100000}}
Interval: {Time: {Duration: {eq: 300}}}
}
) {
Token {
Address
Did
Id
IsNative
Name
Network
Symbol
TokenId
}
Currency {
Symbol
Id
Name
}
Interval {
VolumeBased
Time {
Start
End
}
}
Volume {
Base
BaseQuotedInUsd
Quote
Usd
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
Estimate
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
diff: calculate(expression: "Price_Ohlc_Close - Price_Ohlc_Open")
change: calculate(expression: "round(($diff / Price_Ohlc_Open), 3) * 100")
}
}
}
5 Minute Price Change Stream on Solana
This stream uses expressions
{
Trading {
Tokens(
limit: {count: 10}
limitBy: {count: 1 by: Token_Id}
orderBy: [{descending: Block_Time}, {descendingByField: "change"}]
where: {
Token: {Network: {is: "Solana"}}
Volume: {Usd: {gt: 100000}}
Interval: {Time: {Duration: {eq: 300}}}
}
) {
Token {
Address
Did
Id
IsNative
Name
Network
Symbol
TokenId
}
Currency {
Symbol
Id
Name
}
Interval {
VolumeBased
Time {
Start
End
}
}
Volume {
Base
BaseQuotedInUsd
Quote
Usd
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
Estimate
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
diff: calculate(expression: "Price_Ohlc_Close - Price_Ohlc_Open")
change: calculate(expression: "round(($diff / Price_Ohlc_Open), 3) * 100")
}
}
}
Volume-Based Bitcoin Price Stream
subscription {
Trading {
Currencies(
where: {
Interval: {
VolumeBased: true
TargetVolume: {eq: 1000000}
}
Currency: {Id: {is: "bid:bitcoin"}}
}
) {
Currency {
Symbol
Id
Name
}
Interval {
VolumeBased
Time {
Start
End
}
}
Volume {
Base
BaseQuotedInUsd
Quote
Usd
}
Price {
IsQuotedInUsd
Average {
Mean
}
}
}
}
}