A cross-exchange hedging strategy built on exchanges — the unified Go exchange adapter library.
Hedge trading opens positions on two exchanges simultaneously: a maker (limit order for better price) and a taker (market order for guaranteed fill). The spread between exchanges generates profit.
Exchange A (Maker) Exchange B (Taker)
BUY @ $99,950 SELL @ $100,050
(limit, POST-ONLY) (market, instant)
← spread profit →
- Place a limit BUY on the maker exchange (below best bid for maker rebate)
- When maker fills, immediately hedge with market SELL on taker
- Hold position for configurable duration
- Close: limit SELL on maker → market BUY on taker
- Profit = spread between exchanges minus fees
go install github.com/QuantProcessing/hedge-trader@latestOr build from source:
git clone https://github.com/QuantProcessing/hedge-trader.git
cd hedge-trader
go build .cp .env.example .env
# Edit .env with API keys for both exchanges./hedge-trader \
--maker LIGHTER \
--taker BINANCE \
--symbol BTC \
--side long \
--qty 0.01 \
--ticks 3 \
--hold 60 \
--cycle 10| Flag | Description | Default |
|---|---|---|
--maker |
Maker exchange (required) | — |
--taker |
Taker exchange (required) | — |
--symbol |
Trading pair (required) | — |
--side |
Position side: long or short |
long |
--qty |
Order quantity (base currency) (required) | — |
--ticks |
Price offset from BBO in tick steps | 3 |
--open-timeout |
Open position timeout (seconds) | 30 |
--close-timeout |
Close position timeout (seconds) | 60 |
--hold |
Hold duration between open and close (seconds) | 0 |
--cycle |
Number of cycles (0 = infinite) | 0 |
All exchanges powered by exchanges:
Binance, OKX, Hyperliquid, Lighter, Nado, Aster, StandX, GRVT, EdgeX
- Position mismatch between exchanges is the primary risk — the engine validates after each open
- Network latency between exchanges affects hedge timing
- Market orders on taker may experience slippage
- Always start with small quantities to validate the setup
MIT