bitpanda_api/
lib.rs

1//! # bitpanda-api
2//!
3//! bitpanda-api is a Rust client for the Bitpanda API
4//!
5//! ## Get started
6//!
7//! ### Add bitpanda-api to your Cargo.toml 🦀
8//!
9//! ```toml
10//! bitpanda-api = "^0.1"
11//! ```
12//!
13//! Supported features are:
14//!
15//! - `no-log`: disable logging
16//!
17//! ## Example
18//!
19//! ```rust
20//! use bitpanda_api::Client;
21//! use bitpanda_api::model::AssetClass;
22//! use bitpanda_api::model::ohlc::Period;
23//!
24//! #[tokio::main]
25//! async fn main() {
26//!
27//!     let client = Client::default().x_apikey(env!("X_API_KEY"));
28//!
29//!     // collect my last 20 trades
30//!     client.get_trades_ex(Some(20)).await.expect("failed to collect trades");
31//!
32//!     // get OHLC for BTC of the last 5 years
33//!     let btc = client
34//!         .get_assets(AssetClass::Cryptocurrency)
35//!         .await
36//!         .unwrap()
37//!         .into_iter()
38//!         .find(|asset| asset.symbol == "BTC")
39//!         .unwrap();
40//!
41//!     let ohlc = client.get_ohlc(Period::FiveYears, &btc.pid, "EUR").await.unwrap();
42//! }
43//! ```
44//!
45
46#![doc(html_playground_url = "https://play.rust-lang.org")]
47
48#[macro_use]
49extern crate log;
50#[macro_use]
51extern crate serde;
52
53mod api;
54pub mod model;
55
56pub use api::{ApiError, Client};