A Hyperliquid trading terminal (not a library) built with Rust and React/TS. It automates indicator-driven strategies, orchestrates margin across markets, and ships with a beta backtesting view (Binance candles for history, live trading on Hyperliquid).
- Manage multiple Hyperliquid markets with a margin book that syncs on-chain balances before allocating size to the bot.
- Automated signals from
kwantindicators (RSI, StochRSI, EMA cross, ADX, ATR, SMA/EMA) with per-market timeframes and strategy presets (risk/style/stance/follow trend). - React dashboard to add/pause/close markets, cache setups locally, view PnL/trades, and inspect indicator values in real time.
- Backtesting (beta) pulls historical candles from Binance to bypass Hyperliquid’s 5k-candle history cap; only live trading touches Hyperliquid.
- Actix backend (
src/bin/kwant.rs) exposesPOST /command+ws://localhost:8090/wsto the UI and drives order flow viahyperliquid_rust_sdk. - Designed for dedicated bot accounts: manual positions on the same wallet can block markets because the bot keeps margin in sync with on-chain state.
- Rust toolchain (stable).
- Bun (or Node.js) for the React/Vite frontend;
run.shuses Bun. - Hyperliquid API private key and wallet address; optional agent key.
-
Clone and enter the repo:
git clone <repo-url> cd hyperliquid_rust_bot
-
Create a
.envin the project root (loaded by the Actix backend):PRIVATE_KEY=<your API private key> # https://app.hyperliquid.xyz/API AGENT_KEY=<optional agent api public key> WALLET=<public wallet address>
Use a wallet that is not traded manually so the bot fully controls margin.
-
Make the runner executable if needed:
chmod +x ./run.sh
Start everything with one command (backend + frontend):
./run.sh- Backend:
cargo run --release --bin kwantathttp://127.0.0.1:8090(Actix, WebSocket at/ws, logs viaRUST_LOG=info). - Frontend: Vite dev server via Bun (
http://localhost:5173by default). - To target testnet/local, change
BaseUrl::Mainnetinsrc/bin/kwant.rsbefore running.
src/bin/kwant.rs– Actix entrypoint; loads.env, spins up the bot, exposes/commandand/ws.src/– margin book (margin.rs), markets and signal engine (market.rs,signal/), strategy (strategy.rs), executor, wallet helpers, and a backtester scaffold.web_ui/– React + TypeScript + Vite + Tailwind/MUI interface (markets, per-asset detail, settings, backtest). Backtesting candles come from Binance; live trading and margin updates stream from the Actix server.
- Backtesting is beta and purely uses Binance OHLCV; live trades execute on Hyperliquid.
- Manual trades on the same account can interfere with the bot’s margin orchestration; a dedicated account is recommended.
- Experimental software; use at your own risk.