Crate bpx_api_client

Source
Expand description

Backpack Exchange API Client

This module provides the BpxClient for interacting with the Backpack Exchange API. It includes functionality for authenticated and public endpoints, along with utilities for error handling, request signing, and response processing.

§Features

  • Request signing and authentication using ED25519 signatures.
  • Supports both REST and WebSocket endpoints.
  • Includes modules for managing capital, orders, trades, and user data.

§Example

use bpx_api_client::{BACKPACK_API_BASE_URL, BpxClient};

#[tokio::main]
async fn main() {
    let base_url = BACKPACK_API_BASE_URL.to_string();
    let secret = "your_api_secret_here";
    let headers = None;

    let client = BpxClient::init(base_url, secret, headers)
        .expect("Failed to initialize Backpack API client");

    match client.get_open_orders(Some("SOL_USDC")).await {
        Ok(orders) => println!("Open Orders: {:?}", orders),
        Err(err) => tracing::error!("Error: {:?}", err),
    }
}

Re-exports§

Modules§

  • Error handling module for the Backpack Exchange API client.

Structs§

  • A client for interacting with the Backpack Exchange API.

Constants§

Type Aliases§

  • Type alias for custom HTTP headers passed to BpxClient during initialization.