cgko 0.1.3

Unofficial Rust client for the CoinGecko API (cgko)
Documentation

Features

  • Simple - Current prices for coins
  • Coins - Detailed coin data, historical prices, markets
  • Categories - Coin categories and market data
  • Exchanges - Exchange info, tickers, volume
  • Derivatives - Derivatives exchanges and data
  • NFTs - NFT collections, floor prices, market data
  • On-chain - On-chain DEX data (Pro)
  • Global - Global crypto statistics
  • Treasury - Company crypto holdings

Installation

[dependencies]
cgko = "0.1"
tokio = { version = "1", features = ["full"] }

Quick Start

use cgko::Client;

#[tokio::main]
async fn main() -> Result<(), cgko::Error> {
    // Free tier
    let client = 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));
    }

    Ok(())
}

Pro API

// Pro tier with API key
let client = cgko::Client::pro("your-api-key")?;
let markets = client.coins().markets("usd").await?;

Environment Variables

  • COINGECKO_API_KEY - Your CoinGecko Pro API key (optional, for higher rate limits)

Terms of Service

This is an unofficial client. By using this library, you agree to comply with CoinGecko's Terms of Service.

Disclaimer

This crate is not affiliated with or endorsed by CoinGecko.

License

MIT