CoinPaprika Rust SDK

The official Rust client library for the CoinPaprika API provides convenient access to cryptocurrency market data.
This SDK was built by the courtesy of Tokenomia Pro.

Installation

Add the CoinPaprika Rust SDK to your Cargo.toml:
[dependencies]
coinpaprika_api = "0.1"

Quick Start

Free Plan

For basic usage with the free API plan:
use coinpaprika_api::client::Client;
use coinpaprika_api::global::Global;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client = Client::new();

    let global: Global = client.global().send().await?;
    println!("global: {:#?}", global);

    Ok(())
}

Pro Plan

To access Pro features and higher rate limits, initialize the client with your API key.
use coinpaprika_api::client::Client;
use coinpaprika_api::global::Global;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client = Client::with_key("<your-api-key-here>");

    let global: Global = client.global().send().await?;
    println!("global: {:#?}", global);

    Ok(())
}
Get your API key at coinpaprika.com/api

Common Use Cases

Getting Market Data

use coinpaprika_api::client::Client;
use coinpaprika_api::tickers::Tickers;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client = Client::new();

    // Get all tickers
    let tickers: Tickers = client.tickers().send().await?;
    println!("\nTop 5 cryptocurrencies:");
    for ticker in tickers.iter().take(5) {
        let name = &ticker.name;
        let symbol = &ticker.symbol;
        let price = ticker.quotes.get("USD").map_or(0.0, |q| q.price);
        println!("{} ({}): ${:.2}", name, symbol, price);
    }

    Ok(())
}

Coin Information

use coinpaprika_api::client::Client;
use coinpaprika_api::coins::{Coin, Markets};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client = Client::new();

    // Get detailed coin information
    let coin: Coin = client.coin("eth-ethereum").send().await?;
    println!("Name: {}", coin.name);
    println!("Symbol: {}", coin.symbol);
    println!("Active: {}", coin.is_active);

    // Get coin markets
    let markets: Markets = client.coin("eth-ethereum").markets().send().await?;
    println!("Trading on {} markets", markets.len());

    Ok(())
}

Available Methods

Key

Global

Coins

People

Tags

Tickers

Exchanges

Tools

Contracts

Changelog

  • Get id changelog for all coins