Token Trades API
We have two main APIs to get DEX trading data.
- DEXTrades
- DEXTradeByTokens
To learn the difference between two APIs, please check this doc.
Subscribe to realtime DEXTrades on Ethereum Mainnet
The below query will get you the realtime dex trades happening on Ethereum Mainnet. Open the below query in graphQL IDE using this link.
subscription MyQuery {
EVM(network: eth) {
DEXTrades {
Block {
Time
}
Transaction {
Hash
}
Trade {
Buy {
Buyer
AmountInUSD
Amount
Seller
PriceInUSD
Price
Currency {
Name
Symbol
SmartContract
}
}
Dex {
SmartContract
ProtocolName
ProtocolVersion
}
Sell {
Buyer
AmountInUSD
Amount
Seller
PriceInUSD
Price
Currency {
Name
Symbol
SmartContract
}
}
}
}
}
}
Get the Buys, Sells, Buy Volume, Sell Volume and Makers
The query will fetch you the buys, sells, buy volume, sell volume and also the number of makers for a particular token just like how DEXScreener shows in its UI. We are getting these trade metrics for this particular pool address 0x842293fa6ee0642bf61ebf8310e7e546039ba7f4
.
You can find the query here
query MyQuery($network: evm_network, $token: String,$pairAddress: String , $min5_timestamp: DateTime, $hr1_timestamp: DateTime) {
EVM(dataset: realtime, network: $network) {
DEXTradeByTokens(
where: {TransactionStatus: {Success: true}, Trade: {Currency: {SmartContract: {is: $token}}, Dex: {SmartContract: {is: $pairAddress}}}, Block: {Time: {since: $hr1_timestamp}}}
) {
Trade {
Currency {
Name
SmartContract
Symbol
}
startPrice: PriceInUSD(minimum: Block_Time)
Price_at_min5: PriceInUSD(
minimum: Block_Time
if: {Block: {Time: {after: $min5_timestamp}}}
)
current_price: PriceInUSD(maximum: Block_Time)
Dex {
ProtocolName
ProtocolFamily
SmartContract
}
Side {
Currency {
Symbol
Name
SmartContract
}
}
}
makers: count(distinct: Transaction_From)
makers_5min: count(
distinct: Transaction_From
if: {Block: {Time: {after: $min5_timestamp}}}
)
buyers: count(
distinct: Transaction_From
if: {Trade: {Side: {Type: {is: sell}}}}
)
buyers_5min: count(
distinct: Transaction_From
if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $min5_timestamp}}}
)
sellers: count(
distinct: Transaction_From
if: {Trade: {Side: {Type: {is: buy}}}}
)
sellers_5min: count(
distinct: Transaction_From
if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $min5_timestamp}}}
)
trades: count
trades_5min: count(if: {Block: {Time: {after: $min5_timestamp}}})
traded_volume: sum(of: Trade_Side_AmountInUSD)
traded_volume_5min: sum(
of: Trade_Side_AmountInUSD
if: {Block: {Time: {after: $min5_timestamp}}}
)
buy_volume: sum(
of: Trade_Side_AmountInUSD
if: {Trade: {Side: {Type: {is: sell}}}}
)
buy_volume_5min: sum(
of: Trade_Side_AmountInUSD
if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $min5_timestamp}}}
)
sell_volume: sum(
of: Trade_Side_AmountInUSD
if: {Trade: {Side: {Type: {is: buy}}}}
)
sell_volume_5min: sum(
of: Trade_Side_AmountInUSD
if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $min5_timestamp}}}
)
buys: count(if: {Trade: {Side: {Type: {is: sell}}}})
buys_5min: count(
if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $min5_timestamp}}}
)
sells: count(if: {Trade: {Side: {Type: {is: buy}}}})
sells_5min: count(
if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $min5_timestamp}}}
)
}
}
}
{
"network": "eth",
"token": "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
"pairAddress": "0xA43fe16908251ee70EF74718545e4FE6C5cCEc9f",
"hr1_timestamp": "2024-11-14T03:20:00Z",
"min5_timestamp": "2024-11-14T04:15:00Z"
}
Historical Token Trades & Price API
DEXTrades API can give you historical trades. Let's see an example where we get trades of BLUR Token in the past. As you can see, we are using Block -> Time filter, which includes the time. If you want to filter by date, then use Block -> Date. You can also use Block -> Number if you want to filter based on block height. We are setting the seller
and buyer
to 1inch router [0x1111111254eeb25477b68fb85ed929f73a960582] to get both buys and sells of the BLUR token.
{
EVM(dataset: archive, network: eth) {
buyside: DEXTrades(
limit: { count: 10 }
orderBy: { descending: Block_Time }
where: {
Trade: {
Buy: {
Currency: {
SmartContract: {
is: "0x5283d291dbcf85356a21ba090e6db59121208b44"
}
}
Seller: { is: "0x1111111254eeb25477b68fb85ed929f73a960582" }
}
}
Block: {
Time: { since: "2023-03-03T01:00:00Z", till: "2023-03-05T05:15:23Z" }
}
}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
SmartContract
}
Seller
Price
}
Sell {
Amount
Buyer
Currency {
Name
SmartContract
Symbol
}
Seller
Price
}
}
}
sellside: DEXTrades(
limit: { count: 10 }
orderBy: { descending: Block_Time }
where: {
Trade: {
Sell: {
Currency: {
SmartContract: {
is: "0x5283d291dbcf85356a21ba090e6db59121208b44"
}
}
Buyer: { is: "0x1111111254eeb25477b68fb85ed929f73a960582" }
}
}
Block: {
Time: { since: "2023-03-03T01:00:00Z", till: "2023-03-05T05:15:23Z" }
}
}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
SmartContract
}
Seller
Price
}
Sell {
Amount
Buyer
Currency {
Name
SmartContract
Symbol
}
Seller
Price
}
}
}
}
}
Open the above query on GraphQL IDE using this link.
Latest Trades of a Token
This query will fetch you latest trades for a token for the selected network. You can test the query here.
query LatestTrades($network: evm_network, $token: String) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descending: Block_Time}
limit: {count: 50}
where: {Trade: {Currency: {SmartContract: {is: $token}}, Price: {gt: 0}}}
) {
Block {
allTime: Time
}
Trade {
Dex {
OwnerAddress
ProtocolFamily
ProtocolName
}
AmountInUSD
Buyer
Seller
Side {
Type
Buyer
Seller
}
Price
Amount
Side {
Currency {
Symbol
SmartContract
Name
}
AmountInUSD
Amount
}
}
}
}
}
{
"network": "eth",
"token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
}
You can check the data here on DEXrabbit.
Token Trade analytics
Check following query for analytics related to token trades on DEX
{
EVM(network: bsc dataset:combined) {
DEXTradeByTokens(
where: {
Trade: {
Currency: {
SmartContract: {
is: "0xc342774492b54ce5f8ac662113ed702fc1b34972"
}
}
}
}
orderBy: {descendingByField: "usd"}, limit: {count: 1000}) {
Trade {
Currency {
Decimals
Symbol
SmartContract
Fungible
Name
}
Amount(maximum: Block_Number)
AmountInUSD(maximum: Block_Number)
}
pairs: uniq(of: Trade_Side_Currency_SmartContract)
dexes: uniq(of: Trade_Dex_SmartContract)
amount: sum(of: Trade_Amount)
usd: sum(of: Trade_AmountInUSD)
usd2: sum(of: Trade_Side_AmountInUSD)
buyers: uniq(of: Trade_Buyer)
sellers: uniq(of: Trade_Sender)
count
}
}
}
Top Traders of a token
This query will fetch you top traders of a token for the selected network. You can test the query here.
query topTraders($network: evm_network, $token: String) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 100}
where: {Trade: {Currency: {SmartContract: {is: $token}}}}
) {
Trade {
Dex {
OwnerAddress
ProtocolFamily
ProtocolName
}
}
bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
volume: sum(of: Trade_Amount)
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}
{
"network": "eth",
"token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
}
You can check the data here on DEXrabbit.
Get all Trading Pairs data of a specific token
This query will fetch you all the trading pairs of a token for the selected network. You can test the query here.
query tokenTrades($network: evm_network, $token: String, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descendingByField: "usd"}
where: {Trade: {Currency: {SmartContract: {is: $token}}}, Block: {Time: {after: $time_3h_ago}}}
limit: {count: 200}
) {
Trade {
Currency {
Symbol
Name
SmartContract
Fungible
}
Side {
Currency {
Symbol
Name
SmartContract
}
}
price_usd: PriceInUSD(maximum: Block_Number)
price_last: Price(maximum: Block_Number)
price_10min_ago: Price(
maximum: Block_Number
if: {Block: {Time: {before: $time_10min_ago}}}
)
price_1h_ago: Price(
maximum: Block_Number
if: {Block: {Time: {before: $time_1h_ago}}}
)
price_3h_ago: PriceInUSD(minimum: Block_Number)
}
usd: sum(of: Trade_AmountInUSD)
count
}
}
}
{
"network": "eth",
"token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"time_10min_ago": "2024-09-22T12:39:26Z",
"time_1h_ago": "2024-09-22T11:49:26Z",
"time_3h_ago": "2024-09-22T09:49:26Z"
}
You can check the data here on DEXrabbit.
Get all DEXs where a specific token is listed
This query will fetch you all the DEXs where a token is listed for the selected network. You can test the query here.
query tokenDexMarkets($network: evm_network, $token: String) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descendingByField: "amount"}
where: {Trade: {Currency: {SmartContract: {is: $token}}}}
) {
Trade {
Dex {
ProtocolFamily
ProtocolName
}
}
amount: sum(of: Trade_Amount)
pairs: uniq(of: Trade_Side_Currency_SmartContract)
trades: count
}
}
}
{
"network": "eth",
"token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
}
You can check the data here on DEXrabbit.
Latest Trades of a Token pair
This query will fetch you latest trades for a token pair for the selected network. You can test the query here.
query LatestTrades($network: evm_network, $token: String, $base: String) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descending: Block_Time}
limit: {count: 50}
where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}, Currency: {SmartContract: {is: $token}}, Price: {gt: 0}}}
) {
Block {
allTime: Time
}
Trade {
Dex {
OwnerAddress
ProtocolFamily
ProtocolName
}
Currency {
Symbol
SmartContract
Name
}
Price
AmountInUSD
Amount
Side {
Type
Currency {
Symbol
SmartContract
Name
}
AmountInUSD
Amount
}
}
}
}
}
{
"network": "eth",
"token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"base": "0x0ccae1bc46fb018dd396ed4c45565d4cb9d41098"
}
You can check the data here on DEXrabbit.
Get OHLC data for a particular token pair
This query will fetch you the OHLC of a token pair for the selected network. Use PriceAsymmetry
to filter outliers and extremes, read more on it here
You can test the query here.
query tradingViewPairs($network: evm_network, $token: String, $base: String) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {ascendingByField: "Block_Time"}
where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}, Currency: {SmartContract: {is: $token}}, PriceAsymmetry: {lt:0.5}}}
) {
Block {
Time(interval: {count: 5, in: minutes})
}
Trade {
open: PriceInUSD(minimum: Block_Number)
close: PriceInUSD(maximum: Block_Number)
max: PriceInUSD(maximum: Trade_PriceInUSD)
min: PriceInUSD(minimum: Trade_PriceInUSD)
}
volume: sum(of: Trade_Side_Amount)
}
}
}
{
"network": "eth",
"token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"base": "0x0ccae1bc46fb018dd396ed4c45565d4cb9d41098"
}
You can check the data here on DEXrabbit.
Top Traders of a token pair
This query will fetch you top traders of a token pair for the selected network. You can test the query here.
query pairTopTraders($network: evm_network, $token: String, $base: String) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 100}
where: {Trade: {Currency: {SmartContract: {is: $token}}, Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}}}
) {
Trade {
Dex {
OwnerAddress
ProtocolFamily
ProtocolName
}
}
bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
volume: sum(of: Trade_Amount)
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}
{
"network": "eth",
"token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"base": "0x0ccae1bc46fb018dd396ed4c45565d4cb9d41098"
}
You can check the data here on DEXrabbit.
Get all DEXs where a specific token pair is listed
This query will fetch you all the DEXs where a token pair is listed for the selected network. You can test the query here.
query pairDexList($network: evm_network, $token: String, $base: String, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime) {
EVM(network: $network) {
DEXTradeByTokens(
orderBy: {descendingByField: "amount"}
where: {Trade: {Currency: {SmartContract: {is: $token}}, Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}}, Block: {Time: {after: $time_3h_ago}}}
) {
Trade {
Dex {
ProtocolFamily
ProtocolName
}
price_last: PriceInUSD(maximum: Block_Number)
price_10min_ago: PriceInUSD(
maximum: Block_Number
if: {Block: {Time: {before: $time_10min_ago}}}
)
price_1h_ago: PriceInUSD(
maximum: Block_Number
if: {Block: {Time: {before: $time_1h_ago}}}
)
price_3h_ago: PriceInUSD(minimum: Block_Number)
}
amount: sum(of: Trade_Side_Amount)
pairs: uniq(of: Trade_Side_Currency_SmartContract)
trades: count
}
}
}
{
"network": "eth",
"token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"base": "0x0ccae1bc46fb018dd396ed4c45565d4cb9d41098",
"time_10min_ago": "2024-09-22T13:10:42Z",
"time_1h_ago": "2024-09-22T12:20:42Z",
"time_3h_ago": "2024-09-22T10:20:42Z"
}
You can check the data here on DEXrabbit.
Top Gainers
This query will fetch you top gainers for the selected network. You can test the query here.
query ($network: evm_network) {
EVM(network: $network) {
DEXTradeByTokens(orderBy: {descendingByField: "usd"}, limit: {count: 100}) {
Trade {
Currency {
Symbol
Name
SmartContract
}
Side {
Currency {
Symbol
Name
SmartContract
}
}
price_last: PriceInUSD(maximum: Block_Number)
price_1h_ago: PriceInUSD(minimum: Block_Number)
}
dexes: uniq(of: Trade_Dex_OwnerAddress)
amount: sum(of: Trade_Side_Amount)
usd: sum(of: Trade_Side_AmountInUSD)
buyers: uniq(of: Trade_Buyer)
sellers: uniq(of: Trade_Seller)
count(selectWhere: {ge: "100"})
}
}
}
{
"network": "eth"
}
You can check the data here on DEXrabbit.
Top Bought tokens
This query will fetch you top bought tokens for the selected network. Arranged in descending order of bought - sold
.
You can test the query here.
query timeDiagram($network: evm_network) {
EVM(network: $network) {
DEXTradeByTokens(orderBy: {descendingByField: "buy"}, limit: {count: 100}) {
Trade {
Currency {
Symbol
Name
SmartContract
}
}
buy: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
sell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}
{
"network": "eth"
}
You can check the data here on DEXrabbit.
Top Sold tokens
This query will fetch you top sold tokens for the selected network. Arranged in descending order of sold - bought
.
You can test the query here.
query timeDiagram($network: evm_network) {
EVM(network: $network) {
DEXTradeByTokens(orderBy: {descendingByField: "sell"}, limit: {count: 100}) {
Trade {
Currency {
Symbol
Name
SmartContract
}
}
buy: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
sell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}
{
"network": "eth"
}
You can check the data here on DEXrabbit.
Latest Token Trades
To get the latest token trades you just need to sort by Block -> Time.
{
EVM(dataset: archive, network: eth) {
buyside: DEXTrades(
limit: {count: 10}
orderBy: {descending: Block_Time}
where: {Trade: {Buy: {Currency: {SmartContract: {is: "0x5283d291dbcf85356a21ba090e6db59121208b44"}}}}}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
SmartContract
}
Seller
Price
}
Sell {
Amount
Buyer
Currency {
Name
SmartContract
Symbol
}
Seller
Price
}
}
}
sellside: DEXTrades(
limit: {count: 10}
orderBy: {descending: Block_Time}
where: {Trade: {Buy: {Currency: {SmartContract: {is: "0x5283d291dbcf85356a21ba090e6db59121208b44"}}}}}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
SmartContract
}
Seller
Price
}
Sell {
Amount
Buyer
Currency {
Name
SmartContract
Symbol
}
Seller
Price
}
}
}
}
}
Open the above query on GraphQL IDE using this link
Token trade from a specific DEX
If you are looking for token trades on a specific dex, use the following API as an example. Here we are getting WETH Token trades from the Uniswap V3 DEX. You can also use the factory contract of Uniswap-like protocols in the DEX -> OwnerAddress filter to get trades for that DEX.
{
EVM(dataset: archive, network: eth) {
buyside: DEXTrades(
limit: { count: 5 }
orderBy: { descending: Block_Time }
where: {
Trade: {
Buy: {
Currency: {
SmartContract: {
is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
}
}
}
Dex: { ProtocolName: { is: "uniswap_v3" } }
}
}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
SmartContract
}
Seller
Price
}
Sell {
Amount
Buyer
Currency {
Name
SmartContract
Symbol
}
Seller
Price
}
Dex {
ProtocolFamily
ProtocolName
SmartContract
Pair {
SmartContract
}
}
}
}
}
}
Open the above query on GraphQL IDE using this link.
Subscribe to new token trades (WebSocket)
You can use GraphQL subscription (WebSocket) to subscribe to latest trades. In the following example we are subscribing to latest trades for WETH Token.
subscription {
EVM(network: eth, trigger_on: head) {
buyside: DEXTrades(
orderBy: { descending: Block_Time }
where: {
Trade: {
Buy: {
Currency: {
SmartContract: {
is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
}
}
}
}
}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
SmartContract
}
Seller
Price
}
Sell {
Amount
Buyer
Currency {
Name
SmartContract
Symbol
}
Seller
Price
}
}
}
sellside: DEXTrades(
orderBy: { descending: Block_Time }
where: {
Trade: {
Buy: {
Currency: {
SmartContract: {
is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
}
}
}
}
}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
SmartContract
}
Seller
Price
}
Sell {
Amount
Buyer
Currency {
Name
SmartContract
Symbol
}
Seller
Price
}
}
}
}
}
Open the above query on GraphQL IDE using this link
OHLC in USD of a Token
This query retrieves the Open, High, Low, and Close (OHLC) prices in USD for a specific token traded on DEXes over a defined time period and interval. You can use the quoteCurrency
to input the contract address of the currency used for quoting the token prices.
You can find the query here
{
EVM(network: eth, dataset: archive) {
DEXTradeByTokens(
orderBy: {descendingByField: "Block_testfield"}
where: {Trade: {Currency: {SmartContract: {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}}, Side: {Currency: {SmartContract: {is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}}, Type: {is: buy}}}}
limit: {count: 10}
) {
Block {
testfield: Time(interval: {in: hours, count: 1})
}
volume: sum(of: Trade_Amount)
Trade {
high: Price(maximum: Trade_Price)
low: Price(minimum: Trade_Price)
open: Price(minimum: Block_Number)
close: Price(maximum: Block_Number)
}
count
}
}
}
Getting OHLC and Distinct Buys/Sells
The below query retrieve OHLC (Open, High, Low, Close) data and distinct buy/sell information on the Binance Smart Chain (BSC) on a daily basis. Adjust the parameters within the where
and Block
sections to customize the query for your specific needs, such as changing the token smart contract addresses or modifying the date range.
In this query we have set the trade currency pair to 0xfb6115445bff7b52feb98650c87f44907e58f802
( AAVE ) and 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c
(WBNB), i.e AAVE/WBNB.
{
EVM(dataset: archive, network: bsc) {
buyside: DEXTradeByTokens(
limit: {count: 30}
orderBy: {descendingByField:"Block_time_field"}
where: {Trade: {Side: {Currency: {SmartContract: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}}, Amount: {ge: "0"}, Type: {is: buy}}, Currency: {SmartContract: {is: "0xfb6115445bff7b52feb98650c87f44907e58f802"}}}, Block: {Date: {since: "2023-07-01", till: "2023-08-01"}}}
) {
Block {
time_field:Time(interval: {in: days, count: 1})
}
volume: sum(of: Trade_Amount)
distinctBuyer: count(distinct: Trade_Buyer)
distinctSeller: count(distinct: Trade_Seller)
distinctSender: count(distinct: Trade_Sender)
distinctTransactions: count(distinct: Transaction_Hash)
total_sales: count(
if: {Trade: {Side: {Currency: {SmartContract: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}}}}}
)
total_buys: count(
if: {Trade: {Currency: {SmartContract: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}}}}
)
total_count: count
Trade {
Currency {
Name
}
Side {
Currency {
Name
}
}
high: Price(maximum: Trade_Price)
low: Price(minimum: Trade_Price)
open: Price(minimum: Block_Number)
close: Price(maximum: Block_Number)
}
}
}
}
Get Least Traded Token
The below query gets least traded tokens within a specified time frame on the Ethereum network. By querying the DEX trades and sorting them based on the least number of trades, it provides insights into tokens with minimal trading activity during the designated period.
query MyQuery {
EVM(dataset: archive, network: eth) {
DEXTradeByTokens(
limit: {count: 10}
where: {Block: {Time: {after: "2023-11-20T00:00:00Z", before: "2023-11-27T00:00:00Z"}}}
orderBy: {ascendingByField: "count"}
) {
Trade {
Currency {
Name
SmartContract
}
}
count
}
}
}
First X Buyers of a Token
This query retrieves the first X number of buyers for a specific token within the Ethereum network. Replace the token address of the token you want in the Currency SmartContract
field.
You can find the query here
{
EVM(dataset: archive, network: eth) {
buyside: DEXTrades(
limit: {count: 10}
limitBy: {by: Transaction_From, count: 1}
orderBy: {ascending: Block_Time}
where: {Trade: {Buy: {Currency: {SmartContract: {is: "0x5283d291dbcf85356a21ba090e6db59121208b44"}}}}}
) {
Block {
Number
Time
}
Transaction {
From
To
Hash
}
Trade {
Buy {
Amount
Buyer
Currency {
Name
Symbol
}
Seller
Price
}
}
}
}
}