Expand description
§gecko
Unofficial Rust client for the CoinGecko API.
§Quick Start
let client = cgko::Client::new()?;
// Get Bitcoin price
let prices = client.simple().price(&["bitcoin"], &["usd"]).await?;
println!("{:?}", prices);
// Get trending coins
let trending = client.global().trending().await?;
for item in trending.coins.iter().take(5) {
println!("{}: #{}", item.item.name, item.item.market_cap_rank.unwrap_or(0));
}§Pro API
let client = cgko::Client::pro("your-api-key")?;
let markets = client.coins().markets("usd").await?;§GeckoTerminal (Onchain)
let client = cgko::Client::new()?;
let pools = client.onchain().trending_pools().await?;Re-exports§
Modules§
- base_
urls - Base URLs for the
CoinGeckoAPI - categories
- Categories endpoints
- client
- HTTP client for the
CoinGeckoAPI - coins
- Coins data endpoints
- derivatives
- Derivatives endpoints
- error
- Error types for the
CoinGeckoAPI client - exchanges
- Exchanges data endpoints
- global
- Global and general data endpoints
- nfts
- NFT endpoints
- onchain
- Onchain/GeckoTerminal endpoints
- simple
- Simple price endpoints
- treasury
- Treasury endpoints (public companies and governments holding crypto)
Structs§
- Http
Client Config - HTTP client configuration
- Retry
Config - Configuration for retry behavior
- Retry
Error - Error wrapper that includes retry information
Traits§
- Retryable
Error - Determines if an error should be retried
Functions§
- default_
config - Create a default
CoinGeckoconfig (demo mode) - demo_
config_ with_ key - Create a demo config with API key
- pro_
config - Create a Pro config with API key
- with_
retry - Execute an async operation with retries
- with_
simple_ retry - Simple retry wrapper for operations that return Result with any error type