Skip to content

mkzung/fundarb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fundarb — funding-rate arbitrage CLI

A multi-venue command-line tool for monitoring and arbitraging funding rates on crypto perpetual-futures venues.

Adds a thin, uniform abstraction over four perpetuals exchanges, normalizes funding-rate quotes, identifies cross-venue divergences, and (optionally) places offsetting positions to capture the funding spread.

Venues supported

Venue Module Auth Notes
Hyperliquid src/hyperliq/ EVM key (PRIVATE_KEY) Uses hyperliquid-python-sdk
Orderly Network src/orderly/ EVM key + Orderly Ed25519 secret + EIP-712 Custom client + signer (no SDK)
Backpack src/backpack/ (read-only funding rates) Public funding-rate fetch
Apex (preview) src/apex/ Skeleton + funding-rate fetch

Strategy

src/strategies/funding_rate_arbitrage.py ranks venues by signed funding rate and surfaces pairs whose spread exceeds a configurable threshold. The CLI lets the operator select a venue pair and instrument; orders go through each venue's order module (order.py).

Run

python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

cp .env.example .env   # see "Environment" below; this file is git-ignored
python main.py

The CLI is interactive: pick the venue pair → instrument → strategy parameters.

RUN_MAINNET=0 switches all venues to testnet (default). RUN_MAINNET=1 requires production keys.

Environment

All credentials are loaded from a local .env (git-ignored). Required variables:

PRIVATE_KEY=0x…                       # EVM private key (Orderly + Hyperliquid)
ORDERLY_SECRET_TESTNET=…              # Orderly Ed25519 secret (testnet)
ORDERLY_SECRET_MAINNET=…              # Orderly Ed25519 secret (mainnet, optional)
HYPERLIQUID_…                         # Hyperliquid SDK config
RUN_MAINNET=0                          # 0=testnet (default), 1=mainnet

Never commit .env.gitignore already excludes it.

Repo layout

fundarb/
├── main.py                          # CLI entry point
├── requirements.txt
├── src/
│   ├── hyperliq/                    # Hyperliquid client wrapper, funding rates, orders
│   ├── orderly/                     # Orderly client + EIP-712 signer + funding rates
│   ├── backpack/                    # Backpack public funding-rate fetcher
│   ├── apex/                        # Apex skeleton (funding rates only)
│   └── strategies/
│       └── funding_rate_arbitrage.py
└── public/                          # static assets

Notes & limitations

  • Currently no order-book reconciliation step before entering a position; relies on the venues' own slippage controls.
  • Funding-rate calculation conventions vary by venue (8h vs 1h funding intervals, taker/maker funding); the arbitrage module normalizes to a per-hour scale, but operators should sanity-check before live trading.
  • Read-only mode: setting all _KEY env vars to empty disables ordering — the tool still runs as a funding-rate dashboard.

Author

Maksim Gorbuk — github.com/mkzung · linkedin.com/in/gorbuk · gorbuk.maxim@gmail.com

Built while studying CS at Peter the Great St. Petersburg Polytechnic University and researching venture capital at the Stanford GSB Venture Capital Initiative.

About

Cross-venue funding-rate arbitrage CLI for crypto perpetuals — Hyperliquid + Orderly + Backpack. Python, ed25519/EIP-712 signing, testnet/mainnet config.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages