Module signed_request

Module signed_request 

Source
Expand description

Signed request builder for Bybit API.

This module provides a builder pattern for creating authenticated Bybit API requests, encapsulating the common signing workflow used across all authenticated endpoints.

§Overview

The BybitSignedRequestBuilder eliminates code duplication by centralizing:

  • Credential validation
  • Millisecond timestamp generation
  • Parameter signing with HMAC-SHA256 (hex encoded)
  • Authentication header injection
  • HTTP request execution

§Example

let bybit = Bybit::new(ExchangeConfig::default())?;

// Simple GET request
let data = bybit.signed_request("/v5/account/wallet-balance")
    .param("accountType", "UNIFIED")
    .execute()
    .await?;

// POST request with body
let data = bybit.signed_request("/v5/order/create")
    .method(HttpMethod::Post)
    .param("category", "spot")
    .param("symbol", "BTCUSDT")
    .param("side", "Buy")
    .execute()
    .await?;

Structs§

BybitSignedRequestBuilder
Builder for creating authenticated Bybit API requests.

Enums§

HttpMethod
HTTP request methods supported by the signed request builder.