๐ชท LotusX - Multi-Exchange Crypto Connectors Gateway: A secure, high-performance Rust library for cryptocurrency exchange APIs with unified interfaces across multiple platforms.
LotusX
LotusX is an async Rust library for cryptocurrency exchange connectors. It provides a shared core for configuration, typed financial data, REST/WebSocket transport, signing, and exchange-specific connector modules.
The current repository is a library crate with a small binary demo in src/main.rs. The demo fetches Binance perpetual markets.
Supported Modules
| Module | Market data | Trading | Account | Funding rates | | --- | --- | --- | --- | --- | | binance | yes | yes | yes | no | | binance_perp | yes | yes | yes | yes | | bybit | yes | yes | yes | no | | bybit_perp | yes | yes | yes | yes | | backpack | yes | yes | yes | no | | hyperliquid | yes | yes | yes | no | | okx | yes | yes | yes | no | | paradex | yes | yes | yes | yes |
Each active exchange module follows the same shape:
src/exchanges/<exchange>/
โโโ builder.rs
โโโ codec.rs
โโโ connector/
โ โโโ account.rs
โ โโโ market_data.rs
โ โโโ mod.rs
โ โโโ trading.rs
โโโ conversions.rs
โโโ mod.rs
โโโ rest.rs
โโโ signer.rs
โโโ types.rs
Quick Start
cargo check --all-targets --all-features
cargo test --all-features
cargo run
cargo run uses public Binance perpetual market data and requires network access.
Use the crate from another project:
[dependencies]
lotusx = { path = ".", features = ["env-file"] }
tokio = { version = "1.0", features = ["full"] }
Basic market-data usage:
use lotusx::core::config::ExchangeConfig;
use lotusx::core::traits::MarketDataSource;
use lotusx::exchanges::binance::build_connector;
#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let config = ExchangeConfig::read_only().testnet(true); let binance = build_connector(config)?;
let markets = binance.get_markets().await?; println!("Found {} markets", markets.len());
Ok(()) }
Typed order request shape:
use lotusx::core::types::{
conversion, OrderRequest, OrderSide, OrderType, TimeInForce,
};
let order = OrderRequest { symbol: conversion::stringtosymbol("BTCUSDT"), side: OrderSide::Buy, order_type: OrderType::Limit, quantity: conversion::stringtoquantity("0.001"), price: Some(conversion::stringtoprice("30000")), timeinforce: Some(TimeInForce::GTC), stop_price: None, };
Environment
Configuration is read with {EXCHANGE}APIKEY, {EXCHANGE}SECRETKEY, optional {EXCHANGE}TESTNET, and optional {EXCHANGE}BASE_URL.
BINANCEAPIKEY=...
BINANCESECRETKEY=...
BINANCE_TESTNET=true
BYBITAPIKEY=... BYBITSECRETKEY=... BYBIT_TESTNET=true
BACKPACKAPIKEY=... BACKPACKSECRETKEY=...
HYPERLIQUIDAPIKEY=... HYPERLIQUIDSECRETKEY=... HYPERLIQUID_TESTNET=true
OKXAPIKEY=... OKXSECRETKEY=... OKX_PASSPHRASE=... OKX_TESTNET=true
PARADEXAPIKEY=... PARADEXSECRETKEY=... PARADEX_TESTNET=true
Keep real credentials in .env; the file is ignored by git.
Examples
cargo run --example basic_usage
cargo run --example bybit_example
cargo run --example hyperliquid_example
cargo run --example okx_example
cargo run --example backpack_example
cargo run --example paradex_example
cargo run --example connection_test
cargo run --example latency_test -- --quick
cargo run --example customlatencytest
Documentation
Historical plans, migrations, reports, and older analysis notes are under docs/archive.Safety
Use testnet first, keep API keys out of commits, and leave order-placement examples commented until the target account, symbol, size, and price are intentional.