gateio-rs

Crates.iogateio-rs
lib.rsgateio-rs
version0.1.0
created_at2025-07-25 07:11:40.634033+00
updated_at2025-07-25 07:11:40.634033+00
descriptionComprehensive Rust SDK for Gate.io cryptocurrency exchange API with sync and async support
homepagehttps://github.com/volkovartem77/gateio-rs
repositoryhttps://github.com/volkovartem77/gateio-rs
max_upload_size
id1767276
size241,712
kusko (volkovartem77)

documentation

README

Gate.io Rust SDK

A comprehensive Rust SDK for the Gate.io cryptocurrency exchange API, supporting both synchronous and asynchronous HTTP clients.

Features

  • Dual client support: Synchronous (ureq) and asynchronous (hyper) HTTP clients
  • Complete Spot API: All Gate.io Spot trading endpoints implemented
  • Type safety: Strong typing for all API parameters and responses
  • Authentication: Automatic HMAC SHA-512 signing for authenticated requests
  • Builder pattern: Ergonomic request building with optional parameters

Quick Start

Installation

Add this to your Cargo.toml:

# For synchronous client (default)
[dependencies]
gateio-rs = "0.1"

# For asynchronous client
[dependencies]
gateio-rs = { version = "0.1", features = ["enable-hyper"], default-features = false }

Basic Usage

Public API (No Authentication Required)

use gateio_rs::{api::spot::get_ticker, ureq::GateHttpClient};
use serde_json::Value;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = GateHttpClient::default();
    
    // Get ticker for BTC_USDT
    let request = get_ticker()
        .currency_pair("BTC_USDT")
        .timezone("utc8");
    
    let response = client.send(request)?;
    let body = response.into_body_str()?;
    let ticker_data: Value = serde_json::from_str(&body)?;
    
    println!("BTC_USDT Ticker: {}", serde_json::to_string_pretty(&ticker_data)?);
    Ok(())
}

Authenticated API

use gateio_rs::{
    api::spot::get_account,
    http::Credentials,
    ureq::GateHttpClient,
};
use serde_json::Value;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Set up credentials
    let credentials = Credentials::new("your_api_key", "your_api_secret");
    let client = GateHttpClient::default().credentials(credentials);
    
    // Get account information
    let request = get_account();
    let response = client.send(request)?;
    let body = response.into_body_str()?;
    let account_data: Value = serde_json::from_str(&body)?;
    
    println!("Account: {}", serde_json::to_string_pretty(&account_data)?);
    Ok(())
}

API Coverage

The SDK provides complete coverage of Gate.io Spot trading API endpoints:

  • Market Data: Tickers, order books, trades, candlesticks
  • Account Management: Balance, trading fees, account history
  • Trading: Create/cancel orders, batch operations, order history
  • Currency Information: Supported currencies and trading pairs

Documentation

License

This project is licensed under either of

at your option.

Commit count: 0

cargo fmt