run_all_examples/
run_all_examples.rs1use coinbase_v3::{basic_oauth::OAuthCbClient, client::CbClient, utils};
2
3pub mod get_accounts;
4pub mod get_fees;
5pub mod get_orders;
6pub mod get_products;
7
8use get_accounts::run_list_get_accounts;
9use get_fees::run_get_transactions_summary;
10use get_orders::{run_list_fills, run_list_orders};
11use get_products::{
12 run_get_bid_ask, run_get_market_trades, run_get_product, run_get_product_book,
13 run_get_product_candles, run_list_products,
14};
15
16#[tokio::main]
17async fn main() {
18 let (client_id, client_secret, redirect_url) = utils::get_env_variables();
19 let oauth_cb_client = OAuthCbClient::new(&client_id, &client_secret, &redirect_url)
20 .add_scope("wallet:accounts:read")
21 .add_scope("wallet:transactions:read")
22 .add_scope("wallet:user:read")
23 .authorize_once()
24 .await;
25
26 let cb_client = CbClient::new(&oauth_cb_client);
27
28 run_list_get_accounts(&cb_client).await;
29
30 run_list_orders(&cb_client).await;
31 run_list_fills(&cb_client).await;
32
33 run_get_bid_ask(&cb_client).await;
34 run_get_product_book(&cb_client).await;
35 run_list_products(&cb_client).await;
36 run_get_product(&cb_client).await;
37 run_get_product_candles(&cb_client).await;
38 run_get_market_trades(&cb_client).await;
39 run_get_transactions_summary(&cb_client).await;
40
41 oauth_cb_client.revoke_access().await;
42}