Crates.io | coinbase_pro |
lib.rs | coinbase_pro |
version | 0.1.1 |
source | src |
created_at | 2022-05-21 09:07:20.874406 |
updated_at | 2022-05-24 15:27:23.087548 |
description | A Rust API for retriving data and placing trades on Coinbase Pro |
homepage | |
repository | https://github.com/bikester1/coinbase_pro_rust_api |
max_upload_size | |
id | 590641 |
size | 287,785 |
coinbase_pro is an api for getting market data from the coinbase pro public API. This crate aims to be a simple lightweight interface for making requests to coinbase's API. This crate also aims to make available abstractions at the lowest level possible. This allows users to specify how the responses get parsed.
This api has a main client struct called [CBProAPI]. This struct is like a reqwest struct and can be cheaply copied, cloned, and passed between threads. Internally it implements its state utilizing std::sync::Arc and tokio::sync::Mutex.
In addition to the standard usage of this api through [CBProAPI], this crate exposes a low level [CBRequestBuilder] that allows additional endpoints and custom deserialization if coinbase ever changed their api, endpoints, or data formats.
use coinbase_pro::api::CBProAPI;
#[tokio::test]
async fn get_product() {
let api = CBProAPI::default();
let product = api.get_product("ETH-USD".to_string()).await.unwrap();
assert_eq!(product.display_name, "ETH-USD");
}