Struct coingecko_rs::CoinGeckoClient
source · [−]pub struct CoinGeckoClient { /* private fields */ }
Expand description
CoinGecko client
Implementations
sourceimpl CoinGeckoClient
impl CoinGeckoClient
sourcepub fn new(host: &'static str) -> Self
pub fn new(host: &'static str) -> Self
Creates a new CoinGeckoClient client with a custom host url
Examples
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::new("https://some.url");
sourcepub async fn ping(&self) -> Result<SimplePing, Error>
pub async fn ping(&self) -> Result<SimplePing, Error>
Check API server status
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.ping().await;
}
sourcepub async fn price<Id: AsRef<str>, Curr: AsRef<str>>(
&self,
ids: &[Id],
vs_currencies: &[Curr],
include_market_cap: bool,
include_24hr_vol: bool,
include_24hr_change: bool,
include_last_updated_at: bool
) -> Result<HashMap<String, Price>, Error>
pub async fn price<Id: AsRef<str>, Curr: AsRef<str>>(
&self,
ids: &[Id],
vs_currencies: &[Curr],
include_market_cap: bool,
include_24hr_vol: bool,
include_24hr_change: bool,
include_last_updated_at: bool
) -> Result<HashMap<String, Price>, Error>
Get the current price of any cryptocurrencies in any other supported currencies that you need
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.price(&["bitcoin", "ethereum"], &["usd"], true, true, true, true).await;
}
sourcepub async fn token_price<Addr: AsRef<str>, Curr: AsRef<str>>(
&self,
id: &str,
contract_addresses: &[Addr],
vs_currencies: &[Curr],
include_market_cap: bool,
include_24hr_vol: bool,
include_24hr_change: bool,
include_last_updated_at: bool
) -> Result<HashMap<String, Price>, Error>
pub async fn token_price<Addr: AsRef<str>, Curr: AsRef<str>>(
&self,
id: &str,
contract_addresses: &[Addr],
vs_currencies: &[Curr],
include_market_cap: bool,
include_24hr_vol: bool,
include_24hr_change: bool,
include_last_updated_at: bool
) -> Result<HashMap<String, Price>, Error>
Get current price of tokens (using contract addresses) for a given platform in any other currency that you need
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
let uniswap_contract = "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984";
client.token_price(
"ethereum",
&[uniswap_contract],
&["usd"],
true,
true,
true,
true,
).await;
}
sourcepub async fn supported_vs_currencies(
&self
) -> Result<SupportedVsCurrencies, Error>
pub async fn supported_vs_currencies(
&self
) -> Result<SupportedVsCurrencies, Error>
Get list of supported_vs_currencies
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.supported_vs_currencies().await;
}
sourcepub async fn coins_list(
&self,
include_platform: bool
) -> Result<Vec<CoinsListItem>, Error>
pub async fn coins_list(
&self,
include_platform: bool
) -> Result<Vec<CoinsListItem>, Error>
List all supported coins id, name and symbol (no pagination required)
Use this to obtain all the coins’ id in order to make API calls
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.coins_list(true).await;
}
sourcepub async fn coins_markets<Id: AsRef<str>>(
&self,
vs_currency: &str,
ids: &[Id],
category: Option<&str>,
order: MarketsOrder,
per_page: i64,
page: i64,
sparkline: bool,
price_change_percentage: &[PriceChangePercentage]
) -> Result<Vec<CoinsMarketItem>, Error>
pub async fn coins_markets<Id: AsRef<str>>(
&self,
vs_currency: &str,
ids: &[Id],
category: Option<&str>,
order: MarketsOrder,
per_page: i64,
page: i64,
sparkline: bool,
price_change_percentage: &[PriceChangePercentage]
) -> Result<Vec<CoinsMarketItem>, Error>
List all supported coins price, market cap, volume, and market related data
Use this to obtain all the coins market data (price, market cap, volume)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{
params::{MarketsOrder, PriceChangePercentage},
CoinGeckoClient,
};
let client = CoinGeckoClient::default();
client.coins_markets(
"usd",
&["bitcoin"],
None,
MarketsOrder::GeckoDesc,
1,
0,
true,
&[
PriceChangePercentage::OneHour,
PriceChangePercentage::TwentyFourHours,
PriceChangePercentage::SevenDays,
PriceChangePercentage::FourteenDays,
PriceChangePercentage::ThirtyDays,
PriceChangePercentage::OneYear,
],
).await;
}
sourcepub async fn coin(
&self,
id: &str,
localization: bool,
tickers: bool,
market_data: bool,
community_data: bool,
developer_data: bool,
sparkline: bool
) -> Result<CoinsItem, Error>
pub async fn coin(
&self,
id: &str,
localization: bool,
tickers: bool,
market_data: bool,
community_data: bool,
developer_data: bool,
sparkline: bool
) -> Result<CoinsItem, Error>
Get current data (name, price, market, … including exchange tickers) for a coin
IMPORTANT: Ticker object is limited to 100 items, to get more tickers, use coin_tickers Ticker is_stale is true when ticker that has not been updated/unchanged from the exchange for a while. Ticker is_anomaly is true if ticker’s price is outliered by our system. You are responsible for managing how you want to display these information (e.g. footnote, different background, change opacity, hide)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.coin("bitcoin", true, true, true, true, true, true).await;
}
sourcepub async fn coin_tickers<Ex: AsRef<str>>(
&self,
id: &str,
exchange_ids: Option<&[Ex]>,
include_exchange_logo: bool,
page: i64,
order: TickersOrder,
depth: bool
) -> Result<Tickers, Error>
pub async fn coin_tickers<Ex: AsRef<str>>(
&self,
id: &str,
exchange_ids: Option<&[Ex]>,
include_exchange_logo: bool,
page: i64,
order: TickersOrder,
depth: bool
) -> Result<Tickers, Error>
Get coin tickers (paginated to 100 items)
IMPORTANT: Ticker is_stale is true when ticker that has not been updated/unchanged from the exchange for a while. Ticker is_anomaly is true if ticker’s price is outliered by our system. You are responsible for managing how you want to display these information (e.g. footnote, different background, change opacity, hide)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{params::TickersOrder, CoinGeckoClient};
let client = CoinGeckoClient::default();
client.coin_tickers::<&str>("bitcoin", None, true, 1, TickersOrder::VolumeDesc, true).await;
}
sourcepub async fn coin_history(
&self,
id: &str,
date: NaiveDate,
localization: bool
) -> Result<History, Error>
pub async fn coin_history(
&self,
id: &str,
date: NaiveDate,
localization: bool
) -> Result<History, Error>
Get historical data (name, price, market, stats) at a given date for a coin
Examples
#[tokio::main]
async fn main() {
use chrono::NaiveDate;
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.coin_history("bitcoin", NaiveDate::from_ymd(2017, 12, 30), true).await;
}
sourcepub async fn coin_market_chart(
&self,
id: &str,
vs_currency: &str,
days: i64,
use_daily_interval: bool
) -> Result<MarketChart, Error>
pub async fn coin_market_chart(
&self,
id: &str,
vs_currency: &str,
days: i64,
use_daily_interval: bool
) -> Result<MarketChart, Error>
Get historical market data include price, market cap, and 24h volume (granularity auto)
Minutely data will be used for duration within 1 day, Hourly data will be used for duration between 1 day and 90 days, Daily data will be used for duration above 90 days.
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.coin_market_chart("bitcoin", "usd", 1, true).await;
}
sourcepub async fn coin_market_chart_range(
&self,
id: &str,
vs_currency: &str,
from: NaiveDateTime,
to: NaiveDateTime
) -> Result<MarketChart, Error>
pub async fn coin_market_chart_range(
&self,
id: &str,
vs_currency: &str,
from: NaiveDateTime,
to: NaiveDateTime
) -> Result<MarketChart, Error>
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto)
- Data granularity is automatic (cannot be adjusted)
- 1 day from query time = 5 minute interval data
- 1 - 90 days from query time = hourly data
- above 90 days from query time = daily data (00:00 UTC)
Examples
#[tokio::main]
async fn main() {
use chrono::NaiveDate;
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
let from = NaiveDate::from_ymd(2014, 2, 16).and_hms(19, 0, 32);
let to = NaiveDate::from_ymd(2015, 1, 30).and_hms(0, 20, 32);
client.coin_market_chart_range("bitcoin", "usd", from, to).await;
}
sourcepub async fn coin_status_updates(
&self,
id: &str,
per_page: i64,
page: i64
) -> Result<StatusUpdates, Error>
pub async fn coin_status_updates(
&self,
id: &str,
per_page: i64,
page: i64
) -> Result<StatusUpdates, Error>
Get status updates for a given coin
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.coin_status_updates("qtum", 10, 1).await;
}
sourcepub async fn coin_ohlc(
&self,
id: &str,
vs_currency: &str,
days: OhlcDays
) -> Result<Vec<Vec<f64>>, Error>
pub async fn coin_ohlc(
&self,
id: &str,
vs_currency: &str,
days: OhlcDays
) -> Result<Vec<Vec<f64>>, Error>
Get coin’s OHLC
Candle’s body: 1 - 2 days: 30 minutes 3 - 30 days: 4 hours 31 and before: 4 days
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{params::OhlcDays, CoinGeckoClient};
let client = CoinGeckoClient::default();
client.coin_ohlc("bitcoin", "usd", OhlcDays::OneDay).await;
}
sourcepub async fn contract(
&self,
id: &str,
contract_address: &str
) -> Result<Contract, Error>
pub async fn contract(
&self,
id: &str,
contract_address: &str
) -> Result<Contract, Error>
Get coin info from contract address
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
let uniswap_contract = "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984";
client.contract("ethereum", &uniswap_contract).await;
}
sourcepub async fn contract_market_chart(
&self,
id: &str,
contract_address: &str,
vs_currency: &str,
days: i64
) -> Result<MarketChart, Error>
pub async fn contract_market_chart(
&self,
id: &str,
contract_address: &str,
vs_currency: &str,
days: i64
) -> Result<MarketChart, Error>
Get historical market data include price, market cap, and 24h volume (granularity auto)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
let uniswap_contract = "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984";
client.contract_market_chart("ethereum", &uniswap_contract, "usd", 1).await;
}
sourcepub async fn contract_market_chart_range(
&self,
id: &str,
contract_address: &str,
vs_currency: &str,
from: NaiveDateTime,
to: NaiveDateTime
) -> Result<MarketChart, Error>
pub async fn contract_market_chart_range(
&self,
id: &str,
contract_address: &str,
vs_currency: &str,
from: NaiveDateTime,
to: NaiveDateTime
) -> Result<MarketChart, Error>
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto)
Examples
#[tokio::main]
async fn main() {
use chrono::NaiveDate;
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
let uniswap_contract = "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984";
let from = NaiveDate::from_ymd(2014, 2, 16).and_hms(19, 0, 32);
let to = NaiveDate::from_ymd(2015, 1, 30).and_hms(0, 20, 32);
client.contract_market_chart_range("ethereum", &uniswap_contract, "usd", from, to).await;
}
sourcepub async fn asset_platforms(&self) -> Result<Vec<AssetPlatform>, Error>
pub async fn asset_platforms(&self) -> Result<Vec<AssetPlatform>, Error>
List all asset platforms (Blockchain networks)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.asset_platforms().await;
}
sourcepub async fn categories_list(&self) -> Result<Vec<CategoryId>, Error>
pub async fn categories_list(&self) -> Result<Vec<CategoryId>, Error>
List all categories
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.categories_list().await;
}
sourcepub async fn categories(&self) -> Result<Vec<Category>, Error>
pub async fn categories(&self) -> Result<Vec<Category>, Error>
List all categories with market data
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.categories().await;
}
sourcepub async fn exchanges(
&self,
per_page: i64,
page: i64
) -> Result<Vec<Exchange>, Error>
pub async fn exchanges(
&self,
per_page: i64,
page: i64
) -> Result<Vec<Exchange>, Error>
List all exchanges
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.exchanges(10, 1).await;
}
sourcepub async fn exchanges_list(&self) -> Result<Vec<ExchangeId>, Error>
pub async fn exchanges_list(&self) -> Result<Vec<ExchangeId>, Error>
List all supported markets id and name (no pagination required)
Use this to obtain all the markets’ id in order to make API calls
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.exchanges_list().await;
}
sourcepub async fn exchange(&self, id: &str) -> Result<Exchange, Error>
pub async fn exchange(&self, id: &str) -> Result<Exchange, Error>
Get exchange volume in BTC and top 100 tickers only
IMPORTANT: Ticker object is limited to 100 items, to get more tickers, use exchange_tickers Ticker is_stale is true when ticker that has not been updated/unchanged from the exchange for a while. Ticker is_anomaly is true if ticker’s price is outliered by our system. You are responsible for managing how you want to display these information (e.g. footnote, different background, change opacity, hide)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.exchange("binance").await;
}
sourcepub async fn exchange_tickers<CoinId: AsRef<str>>(
&self,
id: &str,
coin_ids: Option<&[CoinId]>,
include_exchange_logo: bool,
page: i64,
order: TickersOrder,
depth: bool
) -> Result<Tickers, Error>
pub async fn exchange_tickers<CoinId: AsRef<str>>(
&self,
id: &str,
coin_ids: Option<&[CoinId]>,
include_exchange_logo: bool,
page: i64,
order: TickersOrder,
depth: bool
) -> Result<Tickers, Error>
Get exchange tickers (paginated)
IMPORTANT: Ticker is_stale is true when ticker that has not been updated/unchanged from the exchange for a while. Ticker is_anomaly is true if ticker’s price is outliered by our system. You are responsible for managing how you want to display these information (e.g. footnote, different background, change opacity, hide)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{params::TickersOrder, CoinGeckoClient};
let client = CoinGeckoClient::default();
client.exchange_tickers("binance", Some(&["btc"]), true, 1, TickersOrder::TrustScoreAsc, true).await;
}
sourcepub async fn exchange_status_updates(
&self,
id: &str,
per_page: i64,
page: i64
) -> Result<StatusUpdates, Error>
pub async fn exchange_status_updates(
&self,
id: &str,
per_page: i64,
page: i64
) -> Result<StatusUpdates, Error>
Get status updates for a given exchange
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.exchange_status_updates("binance", 10, 1).await;
}
sourcepub async fn exchange_volume_chart(
&self,
id: &str,
days: i64
) -> Result<Vec<VolumeChartData>, Error>
pub async fn exchange_volume_chart(
&self,
id: &str,
days: i64
) -> Result<Vec<VolumeChartData>, Error>
Get volume_chart data for a given exchange
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.exchange_volume_chart("binance", 1).await;
}
sourcepub async fn finance_platforms(
&self,
per_page: i64,
page: i64
) -> Result<Vec<FinancePlatform>, Error>
pub async fn finance_platforms(
&self,
per_page: i64,
page: i64
) -> Result<Vec<FinancePlatform>, Error>
List all finance platforms
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.finance_platforms(10, 1).await;
}
sourcepub async fn finance_products(
&self,
per_page: i64,
page: i64
) -> Result<Vec<FinanceProduct>, Error>
pub async fn finance_products(
&self,
per_page: i64,
page: i64
) -> Result<Vec<FinanceProduct>, Error>
List all finance products
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.finance_products(10, 1).await;
}
sourcepub async fn indexes(
&self,
per_page: i64,
page: i64
) -> Result<Vec<Index>, Error>
pub async fn indexes(
&self,
per_page: i64,
page: i64
) -> Result<Vec<Index>, Error>
List all market indexes
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.indexes(10, 1).await;
}
sourcepub async fn indexes_market_id(
&self,
market_id: &str,
id: &str
) -> Result<MarketIndex, Error>
pub async fn indexes_market_id(
&self,
market_id: &str,
id: &str
) -> Result<MarketIndex, Error>
Get market index by market id and index id
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.indexes_market_id("binance_futures", "BTC").await;
}
sourcepub async fn indexes_list(&self) -> Result<Vec<IndexId>, Error>
pub async fn indexes_list(&self) -> Result<Vec<IndexId>, Error>
List market indexes id and name
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.indexes_list().await;
}
sourcepub async fn derivatives(
&self,
include_tickers: Option<DerivativesIncludeTickers>
) -> Result<Vec<Derivative>, Error>
pub async fn derivatives(
&self,
include_tickers: Option<DerivativesIncludeTickers>
) -> Result<Vec<Derivative>, Error>
List all derivative tickers
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{params::DerivativesIncludeTickers, CoinGeckoClient};
let client = CoinGeckoClient::default();
client.derivatives(Some(DerivativesIncludeTickers::All)).await;
}
sourcepub async fn derivative_exchanges(
&self,
order: DerivativeExchangeOrder,
per_page: i64,
page: i64
) -> Result<Vec<Derivative>, Error>
pub async fn derivative_exchanges(
&self,
order: DerivativeExchangeOrder,
per_page: i64,
page: i64
) -> Result<Vec<Derivative>, Error>
List all derivative exchanges
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{params::DerivativeExchangeOrder, CoinGeckoClient};
let client = CoinGeckoClient::default();
client.derivative_exchanges(DerivativeExchangeOrder::NameAsc, 10, 1).await;
}
sourcepub async fn derivatives_exchange(
&self,
id: &str,
include_tickers: Option<DerivativesIncludeTickers>
) -> Result<Vec<Derivative>, Error>
pub async fn derivatives_exchange(
&self,
id: &str,
include_tickers: Option<DerivativesIncludeTickers>
) -> Result<Vec<Derivative>, Error>
Show derivative exchange data
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{params::DerivativesIncludeTickers, CoinGeckoClient};
let client = CoinGeckoClient::default();
client.derivatives_exchange("bitmex", Some(DerivativesIncludeTickers::All)).await;
}
sourcepub async fn derivative_exchanges_list(
&self
) -> Result<Vec<DerivativeExchangeId>, Error>
pub async fn derivative_exchanges_list(
&self
) -> Result<Vec<DerivativeExchangeId>, Error>
List all derivative exchanges name and identifier
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.derivative_exchanges_list().await;
}
sourcepub async fn status_updates(
&self,
category: Option<&str>,
project_type: Option<&str>,
per_page: i64,
page: i64
) -> Result<StatusUpdates, Error>
pub async fn status_updates(
&self,
category: Option<&str>,
project_type: Option<&str>,
per_page: i64,
page: i64
) -> Result<StatusUpdates, Error>
List all status_updates with data (description, category, created_at, user, user_title and pin)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.status_updates(Some("general"), Some("coin"), 10, 1).await;
}
sourcepub async fn events(
&self,
country_code: Option<&str>,
event_type: Option<&str>,
page: i64,
upcoming_events_only: bool,
from_date: NaiveDate,
to_date: NaiveDate
) -> Result<Events, Error>
pub async fn events(
&self,
country_code: Option<&str>,
event_type: Option<&str>,
page: i64,
upcoming_events_only: bool,
from_date: NaiveDate,
to_date: NaiveDate
) -> Result<Events, Error>
Get events, paginated by 100
Examples
#[tokio::main]
async fn main() {
use chrono::NaiveDate;
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
let from = NaiveDate::from_ymd(2021, 10, 7);
let to = NaiveDate::from_ymd(2022, 10, 7);
client.events(Some("HK"), Some("Event"), 1, true, from, to).await;
}
sourcepub async fn event_countries(&self) -> Result<EventCountries, Error>
pub async fn event_countries(&self) -> Result<EventCountries, Error>
Get list of event countries
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.event_countries().await;
}
sourcepub async fn event_types(&self) -> Result<EventTypes, Error>
pub async fn event_types(&self) -> Result<EventTypes, Error>
Get list of event types
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.event_types().await;
}
sourcepub async fn exchange_rates(&self) -> Result<ExchangeRates, Error>
pub async fn exchange_rates(&self) -> Result<ExchangeRates, Error>
Get BTC-to-Currency exchange rates
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.exchange_rates().await;
}
sourcepub async fn trending(&self) -> Result<Trending, Error>
pub async fn trending(&self) -> Result<Trending, Error>
Top-7 trending coins on CoinGecko as searched by users in the last 24 hours (Ordered by most popular first)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.trending().await;
}
sourcepub async fn global(&self) -> Result<Global, Error>
pub async fn global(&self) -> Result<Global, Error>
Get cryptocurrency global data
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.global().await;
}
sourcepub async fn global_defi(&self) -> Result<GlobalDefi, Error>
pub async fn global_defi(&self) -> Result<GlobalDefi, Error>
Get Top 100 Cryptocurrency Global Eecentralized Finance(defi) data
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::CoinGeckoClient;
let client = CoinGeckoClient::default();
client.global_defi().await;
}
sourcepub async fn companies(
&self,
coin_id: CompaniesCoinId
) -> Result<CompaniesPublicTreasury, Error>
pub async fn companies(
&self,
coin_id: CompaniesCoinId
) -> Result<CompaniesPublicTreasury, Error>
Get public companies bitcoin or ethereum holdings (Ordered by total holdings descending)
Examples
#[tokio::main]
async fn main() {
use coingecko_rs::{params::CompaniesCoinId, CoinGeckoClient};
let client = CoinGeckoClient::default();
client.companies(CompaniesCoinId::Bitcoin).await;
}
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for CoinGeckoClient
impl Send for CoinGeckoClient
impl Sync for CoinGeckoClient
impl Unpin for CoinGeckoClient
impl UnwindSafe for CoinGeckoClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more