Skip to content

QuantProcessing/hedge-trader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hedge Trader

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.

中文文档

How It Works

Exchange A (Maker)          Exchange B (Taker)
  BUY  @ $99,950              SELL @ $100,050
       (limit, POST-ONLY)          (market, instant)
       ← spread profit →
  1. Place a limit BUY on the maker exchange (below best bid for maker rebate)
  2. When maker fills, immediately hedge with market SELL on taker
  3. Hold position for configurable duration
  4. Close: limit SELL on maker → market BUY on taker
  5. Profit = spread between exchanges minus fees

Quick Start

Install

go install github.com/QuantProcessing/hedge-trader@latest

Or build from source:

git clone https://github.com/QuantProcessing/hedge-trader.git
cd hedge-trader
go build .

Configure

cp .env.example .env
# Edit .env with API keys for both exchanges

Run

./hedge-trader \
  --maker LIGHTER \
  --taker BINANCE \
  --symbol BTC \
  --side long \
  --qty 0.01 \
  --ticks 3 \
  --hold 60 \
  --cycle 10

Parameters

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

Supported Exchanges

All exchanges powered by exchanges:

Binance, OKX, Hyperliquid, Lighter, Nado, Aster, StandX, GRVT, EdgeX

Risk Warning

⚠️ Important:

  • 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

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages