find-arbitrage-opps
Find arbitrage opportunities across all Hummingbot-connected exchanges by comparing prices for a trading pair, accounting for fungible tokens (e.g., BTC = WBTC, USDT = USDC).
Prerequisites
Hummingbot API must be running with exchange connectors configured:
CODEBLOCK0
Workflow
Step 1: Define Token Mappings
User specifies the base and quote tokens, including fungible equivalents:
- - Base tokens: BTC, WBTC, cbBTC (all represent Bitcoin)
- Quote tokens: USDT, USDC, USD (all represent USD)
Step 2: Find Arbitrage Opportunities
CODEBLOCK1
Step 3: Analyze Results
The script outputs:
- - Prices from each exchange
- Best bid/ask across all exchanges
- Arbitrage spread (buy low, sell high)
- Recommended pairs for arbitrage
Script Options
CODEBLOCK2
| Option | Description |
|---|
| INLINECODE0 | Base token(s), comma-separated (e.g., BTC,WBTC) |
| INLINECODE1 |
Quote token(s), comma-separated (e.g., USDT,USDC) |
|
--connectors | Filter to specific connectors (optional) |
|
--min-spread | Minimum spread % to show (default: 0.0) |
|
--json | Output as JSON |
Output Example
CODEBLOCK3
Environment Variables
CODEBLOCK4
Scripts check for .env in: ./hummingbot-api/.env → ~/.hummingbot/.env → INLINECODE8
Requirements
- - Hummingbot API running
- Exchange connectors configured with API keys
find-arbitrage-opps
通过比较交易对的价格,并考虑可互换代币(例如,BTC = WBTC,USDT = USDC),在所有与Hummingbot连接的交易所中寻找套利机会。
前置条件
Hummingbot API 必须运行,并配置好交易所连接器:
bash
bash <(curl -s https://raw.githubusercontent.com/hummingbot/skills/main/skills/lp-agent/scripts/check_prerequisites.sh)
工作流程
步骤 1:定义代币映射
用户指定基础代币和报价代币,包括可互换的等价代币:
- - 基础代币:BTC、WBTC、cbBTC(均代表比特币)
- 报价代币:USDT、USDC、USD(均代表美元)
步骤 2:寻找套利机会
bash
基本用法 - 寻找 BTC/USDT 套利机会
python scripts/find
arbopps.py --base BTC --quote USDT
包含可互换代币
python scripts/find
arbopps.py --base BTC,WBTC --quote USDT,USDC
更多示例
python scripts/find
arbopps.py --base ETH,WETH --quote USDT,USDC,USD
python scripts/find
arbopps.py --base SOL --quote USDT,USDC --min-spread 0.1
按特定连接器筛选
python scripts/find
arbopps.py --base BTC --quote USDT --connectors binance,kraken,coinbase
步骤 3:分析结果
脚本输出:
- - 每个交易所的价格
- 所有交易所中的最佳买/卖价
- 套利价差(低价买入,高价卖出)
- 推荐的套利交易对
脚本选项
bash
python scripts/findarbopps.py --help
| 选项 | 描述 |
|---|
| --base | 基础代币,逗号分隔(例如,BTC,WBTC) |
| --quote |
报价代币,逗号分隔(例如,USDT,USDC) |
| --connectors | 筛选特定连接器(可选) |
| --min-spread | 显示的最小价差百分比(默认:0.0) |
| --json | 以 JSON 格式输出 |
输出示例
套利机会:BTC vs USDT
=====================================
发现的价格:
binance BTC-USDT $67,234.50
kraken BTC-USD $67,289.00
coinbase BTC-USD $67,312.25
okx BTC-USDT $67,198.00
hyperliquid BTC-USD $67,245.00
最佳机会:
买入 okx BTC-USDT @ $67,198.00
卖出 coinbase BTC-USD @ $67,312.25
价差:0.17%($114.25)
环境变量
bash
export HUMMINGBOTAPIURL=http://localhost:8000
export API_USER=admin
export API_PASS=admin
脚本按以下顺序检查 .env 文件:./hummingbot-api/.env → ~/.hummingbot/.env → .env
要求
- - Hummingbot API 正在运行
- 已配置带有 API 密钥的交易所连接器