r/algotradingcrypto • u/Funny_Victory2953 • 4d ago
Open-sourced our copy trading execution engine for Hyperliquid, Binance and Bybit (Go + Wails)
Hi everyone!
Full disclosure first: I'm one of the devs behind Miroir, a copy trading tool for Hyperliquid traders. We just open-sourced the client that does the actual trading, and I'm posting here because this sub is probably the best place to find people who will read the code, tell us what's wrong with it, and maybe build something with it.
Repo: github.com/getmiroir/trading-service (EUPL-1.2)
Why we open-sourced it
A copy trading client holds your exchange API keys and places real orders on your accounts, usually while you're not watching. I don't think anyone should run that kind of software on trust alone. So everything that runs on the user's machine and touches keys or positions is now public: you can read it, check it does only what it says, and build and run it yourself.
What it does
It mirrors the positions of Hyperliquid addresses onto your own Binance, Bybit or Hyperliquid account (including Hyperliquid subaccounts and Bybit regions). Every loop it reads the source address's positions from the public Hyperliquid API, reads your account's state from your exchange, computes the target size for each symbol and places the orders to get there.
A few parts that might be interesting even if you don't care about copy trading:
- Order execution: large orders split into fractions, minimum notional handling, optional websocket order routing on Binance and Bybit.
- Concurrency: accounts are synced concurrently, then each symbol within an account concurrently.
- SL/TP: placed automatically and readjusted as positions and prices move. Stop losses are sized so that if all of them trigger at once, the total loss stays within a configurable fraction of your equity above a minimum equity floor. Position sizes aren't touched.
- Auto close-out: all copied positions are closed if equity drops below the floor, or if account or source data can't be read.
- Rate limiting: per-exchange limits, retries with exponential backoff and jitter.
- Secrets: exchange keys live in the OS keyring (Keychain, Secret Service on Linux, DPAPI-encrypted store on Windows), never leave the machine and are redacted from logs.
Plugging in your own logic
The client doesn't decide what to copy by itself. It asks a control API for a few things and handles everything else locally:
- targets: which Hyperliquid address each account follows, with exposure, minimum equity, leverage overrides and excluded symbols
- normalization: the sizing ratio between your account and the source
- symbol mapping: Hyperliquid symbols to Binance/Bybit symbols
By default that's our API, which isn't open source. But the URL is configurable (control_api.url), and the README documents every endpoint the client calls and what goes in and out. So if you want to run this fully on your own, you can fork it and swap those calls for your own logic, or point it at your own server that serves the same endpoints. Pick the addresses you want to follow, your own sizing model, your own symbol mapping, and let the engine handle execution, SL/TP and risk.
The headless binary (cmd/copy-service, also used by the Docker image) is probably the easiest starting point for that.
Stack
The service is written in Go, and the desktop app uses Wails (Go backend + React/TypeScript frontend). We went with Wails because a single Go codebase gives us both a headless binary for Docker and a native desktop app for Windows, macOS and Linux. The background service is actually the same binary as the GUI, started with a flag and installed as a systemd user unit, a launchd service or a Windows service. Curious if anyone here has gone the same route, or regretted it.
Where we'd love help
It handles real money on real accounts, so the more eyes on it, the better. In particular:
- the order execution and SL/TP placement logic, and any edge cases you think we're missing
- how we handle exchange errors and rate limits
- anything that looks off security-wise around key handling
And if you end up forking it and plugging in your own control logic, I'd genuinely love to hear what you build.
How to reach us
The repo is a read-only mirror of our internal one, published at each release, so GitHub issues and PRs are closed for now. Instead:
- Bugs, questions, code review comments: reply here, DM me, or email contact@getmiroir.xyz.
- Security issues: please report them privately to contact@getmiroir.xyz and don't disclose them publicly before they're fixed. SECURITY.md in the repo has the details. And please never send your own keys in a report.
Also curious how you all handle symbol mapping and rate limits when your bots trade across several exchanges.