A Go library for interacting with the DexScreener API. This library provides a simple and intuitive way to fetch token profiles, pair information, and search across DexScreener's supported DEXes.
go get github.com/lajosdeme/dexscreener-apipackage main
import (
"fmt"
api "github.com/lajosdeme/dexscreener-api"
)
func main() {
// Get latest token profiles
profiles, err := api.GetLatestTokenProfiles()
if err != nil {
panic(err)
}
fmt.Printf("Found %d token profiles\n", len(profiles))
}- Full coverage of DexScreener API endpoints
- Proper error handling
- Easy to use interface
- Fully type-safe responses
Fetches the most recently updated token profiles.
profiles, err := GetLatestTokenProfiles() ([]TokenProfile, error)Retrieves the most recently boosted token profiles.
profiles, err := GetLatestBoostedTokenProfiles() ([]BoostedTokenProfile, error)Fetches tokens sorted by number of active boosts.
profiles, err := GetTokensWithMostActiveBoosts() ([]BoostedTokenProfile, error)Checks if orders are paid for a specific token on a chain.
response, err := CheckOrdersPaid(chainId string, tokenAddress string) (*OrderPaidResponse, error)Retrieves specific trading pairs by chain ID and pair ID.
pairs, err := GetPairsByChainAndPairId(chainId string, pairId string) (*PairsResponse, error)Fetches pair information for multiple token addresses (up to 30).
pairs, err := GetTokenPairs(tokenAddresses []string) (*PairsResponse, error)Searches for pairs across all supported DEXes.
pairs, err := SearchPairs(searchText string) (*PairsResponse, error)package main
import (
"fmt"
api "github.com/lajosdeme/dexscreener-api"
)
func main() {
// Search for USDC pairs
pairs, err := api.SearchPairs("SOL/USDC")
if err != nil {
panic(err)
}
// Print pair information
for _, pair := range pairs.Pairs {
fmt.Printf("Chain: %s\n", pair.ChainId)
fmt.Printf("DEX: %s\n", pair.DexId)
fmt.Printf("Price USD: %s\n", pair.PriceUsd)
fmt.Printf("Liquidity USD: %.2f\n", pair.Liquidity.USD)
fmt.Printf("---\n")
}
}package main
import (
"fmt"
api "github.com/lajosdeme/dexscreener-api"
)
func main() {
// Token addresses to check
addresses := []string{
"JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN",
"7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr",
}
// Get pair information
response, err := api.GetTokenPairs(addresses)
if err != nil {
panic(err)
}
// Print pair information
for _, pair := range response.Pairs {
fmt.Printf("Base Token: %s (%s)\n", pair.BaseToken.Name, pair.BaseToken.Symbol)
fmt.Printf("Quote Token: %s (%s)\n", pair.QuoteToken.Name, pair.QuoteToken.Symbol)
fmt.Printf("Price: $%s\n", pair.PriceUsd)
fmt.Printf("---\n")
}
}DexScreener API has rate limits. This library does not automatically handle rate limiting, but it does provide clear error messages when you hit rate limits. It's recommended to implement your own rate limiting strategy based on your needs.
Contributions are welcome! Please feel free to submit a Pull Request.
This library is licensed under the MIT License - see the LICENSE file for details.
For more details about the API endpoints and responses, please refer to the official DexScreener API documentation.