FundingArb automates delta-neutral funding arbitrage on crypto perpetual futures — long spot, short futures, same size. Funding payments are collected at every cycle. Runs 24/7 in Docker, no manual intervention required.
Perpetual futures use funding rates to stay anchored to spot price. When longs outnumber shorts, the rate goes positive — shorts get paid. FundingArb captures that payment automatically. The delta-neutral structure means price moves in either direction don't affect the P&L — but fee drag and negative rates are still real risks.
The scanner checks all active perpetual futures, ranks by funding rate, and filters by minimum 24h volume to ensure liquidity.
A spot long and a futures short of identical size are placed simultaneously. Price moves cancel out — if BTC drops $500, the spot loses $500 and the futures short gains $500. Net price P&L = $0. Fee coverage is verified before entry.
The futures short receives payment from longs at each funding interval (4h or 8h depending on exchange and symbol) as long as the rate stays positive. Timing is optimized to never leave a payment on the table.
When the rate falls below your threshold, the bot closes both legs cleanly. Orphaned legs from crashes are detected and cleaned up on restart.
Built with the same safeguards you'd expect from institutional trading infrastructure — not a toy script.
Spot long + futures short hedged 1:1. BTC can go to zero or moon — your net P&L is unaffected by price.
Scans all perpetuals continuously. Ranks by rate, filters by volume, and applies fee coverage checks before any entry.
Exits automatically when mark price approaches liquidation within your configured buffer. Liquidation exits are never suppressed.
Suppresses rate-based exits when a funding payment is imminent. Won't exit 5 minutes before you'd collect 2 USDT.
Position state survives restarts. Cost basis and collected funding are tracked across sessions — always up to date.
Detects unhedged legs after a crash and closes them automatically on restart. No manual cleanup required.
Single docker compose up -d to start. Dry-run mode on by default — no real orders until you flip the switch.
Bybit, Bitunix, and Bitget are tested and live. Binance, OKX, Gate.io and 100+ others are available via CCXT — not yet officially verified.
13+ parameters in a single .env file — entry thresholds, leverage, capital limits, margin caps, and more.
From my own Bybit deployment. No simulations, no backtests — exchange records.
Live snapshot · Bybit · 3 positions active · best realized: BSBUSDT 99.1% APR (short spike) · portfolio APR 18.0% · actual returns vary with market conditions and can be lower or negative
Algo trader, not a marketer. I built this for my own use and decided to sell it.
Exchange adapters, configuration, and dashboard in full Python source — inspect everything that touches your API keys. The execution engine is delivered as a compiled Python extension for performance and IP protection.
No subscriptions. No monthly fees. Buy once, own the code forever.
The bot is designed to protect capital first, earn yield second.
Exits the futures leg automatically if mark price comes within your configured distance of liquidation — even if rate is still positive.
Never deploys more than your configured fraction of account balance (default 70%) — leaves room for margin fluctuations.
Only enters if expected funding income over the holding period exceeds round-trip fees by a configurable factor.
Requires multiple consecutive ticks below the exit threshold before closing — avoids reacting to transient rate dips.
API keys only require trading permissions. Withdrawal access is explicitly not needed — and should not be granted.
Run the full bot with real data and full logging — but zero real orders. Default mode until you explicitly disable it.
No sugar-coating. Here are the four scenarios that actually hurt — and how the bot responds to each.
exchanges/ (drop-in, no other changes required)The bot only enters a position if the projected funding income is expected to exceed round-trip trading fees by a configurable multiple (FEE_COVERAGE_FACTOR).
Example on Bybit (taker fee: 0.055% per leg):
A full round trip — open spot, open futures short, close spot, close futures — costs 4 × 0.055% = 0.22% of position size.
At a funding rate of +0.05% per cycle and assuming 3 payment cycles before exit:
Projected yield: 3 × 0.05% = +0.15% < 0.22% fees → entry blocked.
At a rate of +0.10% per cycle × 3 cycles = +0.30% > 0.22% fees → entry cleared, net expected: +0.08%.
With the default FEE_COVERAGE_FACTOR of 2.0×, projected yield must cover 2× the fee cost before entry — meaning the effective minimum entry threshold on Bybit is approximately +0.037% per cycle. You can tune this in the .env file.
Start in dry-run mode within minutes. No subscriptions, no lock-in. Price moves don't affect your P&L.