15 stable releases

1.3.0 Oct 19, 2023
1.2.0 Oct 9, 2023
1.1.9-beta.0 Sep 14, 2023
1.1.5 Aug 24, 2023
0.3.0 Oct 9, 2023

#5 in #coinbase

Download history 24/week @ 2024-07-01 239/week @ 2024-07-29 58/week @ 2024-09-23

58 downloads per month

MIT license

135KB
2K SLoC

Donate with Bitcoin! Donate with Ethereum! Donate with BNB!
crates.io version crates.io downloads

Asynchronous CoinBase Advanced API

The objective of this crate is to grant asynchronous access to the CoinBase Advanced REST and WebSocket API. Included with the crate are ways to organize your API Keys and Secrets inside of a configuration file.

This project is current a work-in-progress. Changes between versions can vary greatly as this API becomes more refined and adapts to CoinBase Advances changing state. I ask you to understand that I am not liable for any issues you may encounter while this project is in this state and encourage you to verify and test before committing to using this yourself in a serious manner.

Contributions are encouraged! The API reference can be seen at CoinBase Advanced API. If you wish to add this to your project, either use cargo add cbadv or add the following line to your dependencies section in Cargo.toml:

[dependencies]
cbadv = { git = "https://github.com/ohkthx/cbadv-rs", branch = "main" }

Features

  • Asynchronous.
  • Easy-to-use REST and WebSocket clients.
  • Configuration file to hold API Key and API Secret. features = ["config"]
  • Covers all REST endpoints currently accessible (as of 20231016).
  • Covers all WebSocket endpoints currently accessible (as of 20231016).
  • Lots of examples! Check them out to get started.

Documentation

Most of the documentation can be accessed by clicking the following link: docs.rs. That documentation is automatically generated and also accessible from crates.io.

Covered API requests

WebSocket API

Client: use cbadv::websocket::WebSocketClient

REST API

Client: use cbadv::rest::RestClient

Added Requests and Features

These functions were created to cover common functionality but not initially part of the CoinBase Advanced API. They may require several API requests to accomplish their results.

TODO

Test all endpoints that are currently untested.

Configuration Feature

Configuration requires you to add the 'config' feature (features = ["config"]) to your Cargo.toml. The default configuration is unusable due to the API requiring a Key and Secret. You can create, modify, and delete API Keys and Secrets with this link.

Copy the config.toml.sample to config.toml and add in your API information. The config.toml file will automatically be read on launch to access your accounts API information. Unlike the depreciated CoinBase Pro API, there's no longer access to Public API endpoints. All access requires authentication. The key and secret is authentication requirements for HTTP requests to be properly signed and accepted by CoinBase.

Custom configurations can be created with additional sections beyond just [coinbase]. See custom_config.toml.sample for an example of the configuration file. An example of how to implement and create a custom configuration file can be seen in custom_config.rs.

Example of enabled config feature in Cargo.toml.

[dependencies]
cbadv = { version = "*", features = ["config"] }

Examples

Check above in the Covered API requests section for possibly covered examples. All examples are located at cbadv-rs/examples directory.

Tips Appreciated!

Wallet addresses are provided below, or click the badges above!

Ethereum (ETH): 0x7d75f6a9c021fcc70691fec73368198823fb0f60
Bitcoin (BTC):  bc1q75w3cgutug8qdxw3jlmqnkjlv9alt3jr7ftha0
Binance (BNB):  0x7d75f6a9c021fcc70691fec73368198823fb0f60

Dependencies

~8–23MB
~361K SLoC