FRArber is a sophisticated cryptocurrency arbitrage trading bot designed to capitalize on funding rate differences across multiple exchanges. The CLI tool enables traders to execute arbitrage strategies by simultaneously opening long and short positions on different exchanges when profitable opportunities arise.
- Multi-Exchange Support: Works with exchanges including Binance, Bybit, Bitget, Phemex
- Real-time Price Monitoring: Stream live price differences between exchanges
- Automated Arbitrage Execution: Open and close arbitrage positions automatically
- Configurable Thresholds: Set custom price difference thresholds for trade execution
- Async Performance: Built with asyncio for high-performance concurrent operations
- Type Safety: Fully typed with Pydantic for reliable data validation
- Binance (USD-M Futures)
- Phemex
- Bybit
- Bitget
- Python 3.11 (required)
- UV package manager
First, install UV if you haven't already:
# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or via pip
pip install uv-
Clone the repository (if not already done):
git clone https://github.com/cheunhong/frarber.git
-
Install dependencies using UV:
uv sync
-
Activate the virtual environment:
source .venv/bin/activate # On macOS/Linux # or .venv\Scripts\activate # On Windows
-
Install the CLI globally (optional):
uv pip install -e .
Before using FRArber, you'll need to configure your exchange API credentials. Create configuration file with filename frarber.yaml in your working directory for each exchange you plan to use.
exchanges:
binanceusdm:
api_key: "BINANCE_API_KEY"
api_secret: "BINANCE_SECRET_KEY"
hedged_mode: true
bybit:
api_key: "BYBIT_API_KEY"
api_secret: "BYBIT_SECRET_KEY"
hedged_mode: true
bitget:
api_key: "BITGET_API_KEY"
api_secret: "BITGET_SECRET_KEY"
password: "BITGET_PASSWORD"
hedged_mode: true
phemex:
api_key: "PHEMEX_API_KEY"
api_secret: "PHEMEX_SECRET_KEY"
hedged_mode: true
slow: trueFRArber provides three main commands:
Stream real-time price differences between two exchanges:
frarber price-diff [BUY_EXCHANGE] [SELL_EXCHANGE] [SYMBOL]Example:
frarber price-diff binanceusdm bybit BTCOptions:
--update-interval: Time between price updates in seconds (default: 1.0)--log-updates / --no-log-updates: Whether to log price updates (default: True)
Execute an arbitrage trade by opening positions on two exchanges:
frarber open [LONG_EXCHANGE] [SHORT_EXCHANGE] [SYMBOL] [TOTAL_SIZE]Example:
frarber open binanceusdm bybit BTC 0.1 --threshold 0.1Options:
--timeout: Maximum time to wait for arbitrage completion in seconds (default: 1800)--threshold: Price difference threshold for arbitrage opportunity as decimal (default: 0.0)
Close existing arbitrage positions:
frarber close [LONG_EXCHANGE] [SHORT_EXCHANGE] [SYMBOL] [TOTAL_SIZE]Example:
frarber close binanceusdm bybit BTC 0.1Options:
--timeout: Maximum time to wait for arbitrage completion in seconds (default: 1800)--threshold: Price difference threshold for arbitrage opportunity as decimal (default: 0.001)
Use these identifiers when specifying exchanges in commands:
| Exchange | Identifier |
|---|---|
| Binance Spot | binance |
| Binance COIN-M Futures | binancecoinm |
| Binance USD-M Futures | binanceusdm |
| Bybit | bybit |
| OKX | okx |
| Phemex | phemex |
| BitMEX | bitmex |
| Bitget | bitget |
| Bitunix | bitunix |
| Coinbase | coinbase |
| CoinEx | coinex |
| Coinw | coinw |
| Deribit | deribit |
| Gate.io | gateio |
| Gemini | gemini |
| Huobi | huobi |
| Hyperliquid | hyperliquid |
| Kraken | kraken |
| KuCoin Spot | kucoin |
| KuCoin Futures | kucoinfutures |
| MEXC | mexc |
| LBank | lbank |
| WOO | woo |
| Upbit | upbit |
uv run pytestuv run black .
uv run ruff check --fix .- Market volatility: Rapid price movements can turn profitable trades into losses
- Execution risk: Network latency and exchange downtime can affect trade execution
- Funding costs: Holding positions incurs funding fees that may offset profits
- Technical risk: Software bugs or configuration errors can lead to unexpected losses
Always:
- Start with small position sizes
- Test thoroughly in a sandbox environment
- Monitor your positions closely
- Never trade with money you can't afford to lose
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please open an issue on GitHub.