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