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§

pub use error::Error;
pub use error::Result;
pub use bpx_api_types as types;

Modules§

error
Error handling module for the Backpack Exchange API client.

Structs§

BpxClient
A client for interacting with the Backpack Exchange API.

Constants§

BACKPACK_API_BASE_URL
The official base URL for the Backpack Exchange REST API.
BACKPACK_WS_URL
The official WebSocket URL for real-time data from the Backpack Exchange.

Type Aliases§

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