Skip to main content

Module bulk_http

Module bulk_http 

Source
Expand description

Bulk Labs HTTP REST API Client

Provides complete HTTP REST API access to the Bulk Labs exchange:

  • Market data endpoints (unsigned)
  • Account query endpoints (unsigned)
  • Trading endpoints (signed)
  • Private endpoints (signed — faucet, etc.)

§Example

use bulk_client::*;
use bulk_client::common::side::Side;
use bulk_client::common::tif::TimeInForce;

#[tokio::main]
async fn main() -> eyre::Result<()> {
    // Read-only client (market data + account queries)
    let client = BulkHttpClient::with_url(
        "https://exchange-api.bulk.trade/api/v1", None,
    )?;

    let ticker = client.get_ticker("BTC-USD").await?;
    println!("BTC mark: {}", ticker.mark_price);

    // Authenticated client (trading)
    let client = BulkHttpClient::with_url(
        "https://exchange-api.bulk.trade/api/v1",
        Some("your_base58_private_key"),
    )?;
    let resp = client.place_limit_order(
        "BTC-USD", Side::Buy, 95_000.0, 0.001,
        TimeInForce::GTC, false, None, None,
    ).await?;
    Ok(())
}

Structs§

BulkHttpClient
HTTP REST API client for Bulk Labs exchange.