bitvavo-api-client
A Rust client library for the Bitvavo API:
- Full REST API coverage: market data, trading, account, balances, deposits, and withdrawals
- WebSocket support for real-time public and private channels
- HMAC-SHA256 authentication for REST and WebSocket
- Async/await support with Tokio
- Strongly typed request/response structures
- Rate limit visibility from response headers
- Amounts and prices kept as strings to preserve exact decimal values
TLS backends
The default rustls-tls feature uses rustls with the operating system certificate store for HTTPS and WSS connections.
To use the platform-native TLS implementation, disable default features and enable native-tls:
[]
= { = "0.1", = false, = ["native-tls"] }
Library
Public REST API client:
use ;
async
Authenticated client:
use ;
use ;
async
WebSocket public channels:
use ;
async
WebSocket private channel:
use ;
use ClientConfig;
async
API coverage
REST endpoints:
| Method | Endpoint | Authentication |
|---|---|---|
time() |
GET /time |
Public |
markets(), market() |
GET /markets |
Public |
assets(), asset() |
GET /assets |
Public |
order_book() |
GET /{market}/book |
Public |
public_trades() |
GET /{market}/trades |
Public |
candles() |
GET /{market}/candles |
Public |
ticker_price(), ticker_prices() |
GET /ticker/price |
Public |
ticker_book(), ticker_books() |
GET /ticker/book |
Public |
ticker_24h(), tickers_24h() |
GET /ticker/24h |
Public |
place_order() |
POST /order |
Required |
get_order() |
GET /order |
Required |
update_order() |
PUT /order |
Required |
cancel_order() |
DELETE /order |
Required |
get_orders() |
GET /orders |
Required |
cancel_orders() |
DELETE /orders |
Required |
open_orders() |
GET /ordersOpen |
Required |
trades() |
GET /trades |
Required |
account() |
GET /account |
Required |
fees() |
GET /account/fees |
Required |
balances(), balance() |
GET /balance |
Required |
deposit_assets() |
GET /depositAssets |
Required |
withdraw_assets() |
POST /withdrawal |
Required |
deposit_history() |
GET /depositHistory |
Required |
withdrawal_history() |
GET /withdrawalHistory |
Required |
WebSocket channels:
ticker- Best bid, best ask, and last price updatesticker24h- 24 hour statisticstrades- Public tradescandles- Candlestick updates per intervalbook- Order book deltas, withget_book()for snapshotsaccount- Order and fill updates for your account (requires authentication)
The WebSocket client does not reconnect on its own.
A WsEvent::ConnectionError reports a transport or TLS failure.
A WsEvent::Closed event signals that the connection ended.
Reconnect with WsClient::connect and resubscribe when this happens.
Configuration
use ClientConfig;
use Duration;
let config = with_credentials
.access_window_ms // Signed request validity window
.timeout // HTTP and WebSocket connection timeout
.rest_url // REST base URL override
.ws_url; // WebSocket URL override
The client rejects unencrypted http and ws URLs by default.
Local tests can opt in with .danger_allow_insecure_transport(true).
Environment variables
You can set credentials via environment variables:
ClientConfig::from_env() and RestClient::from_env() read these variables.
The examples and integration tests also load them from a .env file via dotenvy.
Examples