The cbadv-rs crate provides high-performance, asynchronous access to the Coinbase Advanced REST and WebSocket APIs. This project includes features to securely configure API keys and secrets, making it suitable for developers seeking robust API integration.
This project is currently a work-in-progress. While the crate is usable, API changes or updates may occur as Coinbase Advanced evolves. Please thoroughly test before using in production.
To get started, add this crate to your project using cargo add cbadv
or manually add the following to your Cargo.toml
:
[dependencies]
cbadv = { git = "https://github.com/ohkthx/cbadv-rs", branch = "main" }
- Asynchronous API access with support for REST and WebSocket protocols.
- Authenticated and Public REST Endpoints.
- Builders to create REST and WebSocket Clients.
- Convenient configuration file support for API keys (
features = ["config"]
). - Comprehensive coverage of all accessible REST and WebSocket endpoints (as of 20231206).
- Numerous examples for seamless integration and testing.
Full API documentation is available at docs.rs. You can also find helpful information on crates.io.
Client: use cbadv::{WebSocketClient, WebSocketClientBuilder}
- Authentication:
client.connect
- Subscribe:
client.subscribe
- Unsubscribe:
client.unsubscribe
- Listen:
client.listen
- Channels Supported:
Channel::STATUS
: StatusChannel::CANDLES
: CandlesChannel::TICKER
: TickerChannel::TICKER_BATCH
: Ticker BatchChannel::LEVEL2
: Level 2 Market DataChannel::USER
: User-Specific UpdatesChannel::MARKET_TRADES
: Market TradesChannel::HEARTBEATS
: Hearbeat (maintains connection.)Channel::FUTURES_BALANCE_SUMMARY
: Balance Summary for Futures.
Client: use cbadv::{RestClient, RestClientBuilder}
- Accounts (
client.account
):- List Accounts:
client.account.get_bulk
- Get Account:
client.account.get
- List Accounts:
- Products (
client.product
):- Get Best Bid/Ask:
client.product.best_bid_ask
- Get Product Book:
client.product.product_book
- List Products:
client.product.get_bulk
- Get Product Details:
client.product.get
- Get Product Candles:
client.product.candles
- Get Market Trades (Ticker):
client.product.ticker
- Get Best Bid/Ask:
- Orders (
client.order
):- Create Order:
client.order.create
- Edit Order:
client.order.edit
- Preview Order Edit:
client.order.preview_edit
- Preview Order Create:
client.order.preview_create
- Cancel Order:
client.order.cancel
- List Orders:
client.order.get_bulk
- List Fills:
client.order.fills
- Get Order:
client.order.get
- Close Position (untested):
client.order.close_position
- Create Order:
- Fees (
client.fee
):- Get Transaction Summary:
client.fee.get
- Get Transaction Summary:
- Converts (
client.convert
):- Create Quote:
client.convert.create_quote
- Get Convert:
client.convert.get
- Commit Convert (untested):
client.convert.commit
- Create Quote:
- Portfolios (
client.portfolio
):- Create Portfolio:
client.portfolio.create
- List Portfolios:
client.portfolio.get_all
- Get Portfolio Breakdown:
client.portfolio.get
- Edit Portfolio:
client.portfolio.edit
- Delete Portfolio:
client.portfolio.delete
- Move Funds (untested):
client.portfolio.move_funds
- Create Portfolio:
- Payments (
client.payment
)- List Payments:
client.payment.get_all
- Get Payment:
client.payment.get
- List Payments:
- Data (
client.data
)- API Key Permissions:
client.data.key_permissions
- API Key Permissions:
- Public (
client.public
):- Get API Unix Server Time:
client.public.time
- Get Product Book:
client.public.product_book
- List Products:
client.public.products
- Get Product:
client.public.product
- Get Product Candles:
client.public.candles
- Get Product Ticker:
client.public.ticker
- Get API Unix Server Time:
To enable the configuration feature, include it in your Cargo.toml
:
[dependencies]
cbadv = { version = "*", features = ["config"] }
Set up config.toml
with your API credentials. A sample file can be found at config.toml.sample
. See the custom configuration example for advanced setups.
Explore the examples directory for usage scenarios.
- Test unverified endpoints.
- Expand examples to cover more advanced cases.
Contributions are welcome! Fork the repository, create a feature branch, and submit a pull request.
Support this project via cryptocurrency donations:
Ethereum (ETH): 0x7d75f6a9c021fcc70691fec73368198823fb0f60
Bitcoin (BTC): bc1q75w3cgutug8qdxw3jlmqnkjlv9alt3jr7ftha0
Binance (BNB): 0x7d75f6a9c021fcc70691fec73368198823fb0f60