htx-rs 0.1.0

火币 HTX 现货交易 Rust SDK,支持下单、撤单、查单等主要接口,签名算法兼容官方。
Documentation

htx-rs

火币 HTX 现货交易 Rust SDK

简介

本 crate 提供火币 HTX 现货交易 API 的 Rust 封装,支持下单、撤单、查单等主要接口,签名算法完全兼容官方。

  • 完全模块化,便于二次开发
  • 错误处理采用 anyhow,日志集成 tracing
  • 签名算法严格对齐官方文档

用法示例

use htx_rs::client::SpotTradeClient;
use htx_rs::model::spot_trade::CreateOrderRequest;

let client = SpotTradeClient::new("your_api_key", "your_secret_key", "https://api.huobi.pro");
let req = CreateOrderRequest {
    account_id: "xxxxxx".to_string(),
    symbol: "btcusdt".to_string(),
    order_type: htx_rs::model::spot_trade::OrderType::BuyLimit,
    amount: 0.01,
    price: Some(30000.0),
    client_order_id: None,
    source: "api".to_string(),
};
let resp = client.create_order(&req).unwrap();
println!("order_id={}", resp.order_id);

发布前检查

  • 无 todo!/unimplemented!/panic! 等占位
  • 完整文档与示例
  • Cargo.toml 包信息填写完整

发布

cargo login # 首次需登录 crates.io token
cargo publish

License

MIT