GraphQL Query Top Tokens by 24-Hour Volume per Blockchain
Retrieve the token contracts with the highest 24-hour trading volume on each blockchain.
The Mobula API provides a powerful GraphQL endpoint that allows you to query and explore data for various tokens. This guide will show you how to retrieve the token contracts with the highest 24-hour trading volume per blockchain using GraphQL.
What you’ll need
- Access to the Mobula GraphQL endpoint.
- No API key is required for development purposes.
Walkthrough
Set Up Your Query Parameters
You will be querying the tokens
table, filtering the results by blockchain, and sorting them by 24-hour trading volume in descending order. We will use distinct_on
to get the top token by trading volume for each blockchain.
Apply Filters
To ensure you’re retrieving the tokens with the most trading activity, you can apply additional filters for 24-hour volume and blockchain. This will help refine your search to ensure you’re getting the most relevant tokens on each chain.
Filters:
- 24-Hour Volume (volume_24h_usd): You may filter tokens to only include those with significant trading activity over the last 24 hours.
- Blockchain (chain_id): Separate tokens by blockchain to ensure you’re getting the top volume token on each chain.
Example filters:
- Sort by 24-hour volume in descending order:
order_by: { volume_24h_usd: desc }
- Limit the results to the top token on each blockchain with
distinct_on: chain_id
.
Perform the GraphQL Request
Execute the GraphQL query using cURL, Axios, or any GraphQL client:
Using cURL:
Using Axios:
Using a GraphQL Client (e.g., Apollo Client):
Analyze the Token Data
The API response will include detailed information about each token, such as their name, symbol, contract address, 24-hour trading volume in USD, and the blockchain they are on.
Sample Response:
Leveraging Token Data
With this data, you can:
- Display Top Tokens by Chain: Show the tokens with the highest 24-hour trading volume on each blockchain in your app or dashboard.
- Track Market Performance: Monitor the market trends of top tokens by observing changes in trading volume.
- Build Blockchain-Specific Leaderboards: Create ranked lists of tokens based on trading volume for different blockchains.
Need Help?
Our support team is available to assist with your queries or integration issues.