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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Coinbase pro async client.
//!
//! ## cbpro
//!
//! This crate provides an easy to use Coinbase Pro API wrapper. For private endpoints use [AuthenticatedClient](client/struct.AuthenticatedClient.html).
//! For public endpoints use [PublicClient](client/struct.PublicClient.html) or [AuthenticatedClient::public](client/struct.AuthenticatedClient.html#method.public).
//! All methods belonging to the public or private client will return [QueryBuilder<T>](builder/struct.QueryBuilder.html) which has split implementations per T.
//!
//! The websocket can be found here: [WebSocketFeed](websocket/struct.WebSocketFeed.html).
//! For more details on Coinbase Pro go to [https://docs.pro.coinbase.com](https://docs.pro.coinbase.com).
//!
//! ## Examples
//!
//! ### Async Client
//! ```no_run
//! use cbpro::client::{PublicClient, SANDBOX_URL};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = PublicClient::new(SANDBOX_URL);
//! let products = client.get_products().json::<serde_json::Value>().await?;
//! println!("{}", serde_json::to_string_pretty(&products).unwrap());
//! Ok(())
//! }
//! ```
//! ### Async Pagination
//! ```no_run
//! use cbpro::client::{PublicClient, SANDBOX_URL};
//! use futures::TryStreamExt;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = PublicClient::new(SANDBOX_URL);
//! let mut pages = client
//! .get_trades("BTC-USD")
//! .paginate::<serde_json::Value>()?;
//!
//! while let Some(json) = pages.try_next().await? {
//! println!("{}", serde_json::to_string_pretty(&json).unwrap());
//! tokio::time::sleep(core::time::Duration::new(1, 0)).await;
//! }
//! Ok(())
//! }
//! ```
//! ### Async Websocket
//! ```no_run
//! use cbpro::websocket::{Channels, WebSocketFeed, SANDBOX_FEED_URL};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut feed = WebSocketFeed::connect(SANDBOX_FEED_URL).await?;
//! feed.subscribe(&["BTC-USD"], &[Channels::LEVEL2]).await?;
//!
//! while let Some(value) = feed.json::<serde_json::Value>().await? {
//! println!("{}", serde_json::to_string_pretty(&value).unwrap());
//! }
//! Ok(())
//! }
//! ```
/// Builder and types representing optional methods
/// Public and private clients
/// Errors of this crate
/// Public and private websocket feed
pub use ;
pub use Pages;
pub use WebSocketFeed;