htx-rs

Crates.iohtx-rs
lib.rshtx-rs
version0.1.1
created_at2025-06-21 08:21:08.813556+00
updated_at2025-06-21 09:30:56.69255+00
description火币 HTX 现货交易 Rust SDK,支持下单、撤单、查单等主要接口,签名算法兼容官方。
homepage
repositoryhttps://github.com/blockchain-toolbox/htx-rs
max_upload_size
id1720629
size67,461
(hazeli7777)

documentation

https://docs.rs/htx-rs

README

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

Commit count: 0

cargo fmt