Crate gecko[−][src]
Expand description
gecko
The gecko
crate provides convenient access coingeckos api.
The focus of this crate is on access/retreival of data from coingecko api endpoints and not on convenience or manipulating reponses/data.
Although, if raw text reponses are not desired, the crate has funcitonality to provide coingeckos api response in json objects.
Note: Coingeckos api has a limit of 100 requests per minute.
Examples
Default
#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let gecko_client = gecko::CoinGeckoAPI::default(); let coins_list = gecko::coins::List::required(); let response = gecko_client.get_json(&coins_list).await.unwrap(); println!("{:?}", response); Ok(()) }
Custom
#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let gecko_client = gecko::CoinGeckoAPI::default(); let mut coins_list = gecko::coins::Info::required("premia".to_string()); coins_list.tickers = false; let response = gecko_client.get_json(&coins_list).await.unwrap(); println!("{:?}", response["id"]); Ok(()) }
Or if you do not want the request object to be a mutable variable…
#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let gecko_client = gecko::CoinGeckoAPI::default(); let coins_list = { let mut _tmp = gecko::coins::Info::required("premia".to_string()); _tmp.tickers = false; _tmp }; let response = gecko_client.get_json(&coins_list).await.unwrap(); println!("{:?}", response["id"]); Ok(()) }
For more information about CoinGecko API can be found here
Modules
asset_platforms |
|
categories |
|
coins |
|
companies |
|
contract |
|
derivatives |
|
events |
|
exchange_rates |
|
exchanges |
|
finance |
|
global |
|
indexes |
|
simple |
|
status_updates |
|
trending |
|
Structs
CoinGeckoAPI |
Traits
Route | The Route trait can be implented to give a struct the ability to be used by CoinGeckoAPI |