find-arbitrage-opps
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesefind-arbitrage-opps
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).
通过比较交易对价格,在所有已连接Hummingbot的交易所中寻找套利机会,支持识别同质代币(例如BTC = WBTC,USDT = USDC)。
Prerequisites
前置要求
Hummingbot API must be running with exchange connectors configured:
bash
bash <(curl -s https://raw.githubusercontent.com/hummingbot/skills/main/skills/lp-agent/scripts/check_prerequisites.sh)必须运行Hummingbot API并完成交易所连接器配置:
bash
bash <(curl -s https://raw.githubusercontent.com/hummingbot/skills/main/skills/lp-agent/scripts/check_prerequisites.sh)Workflow
工作流程
Step 1: Define Token Mappings
步骤1:定义代币映射
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)
用户指定基础代币和计价代币,包括可互换的等价代币:
- 基础代币:BTC、WBTC、cbBTC(均代表比特币)
- 计价代币:USDT、USDC、USD(均代表美元)
Step 2: Find Arbitrage Opportunities
步骤2:寻找套利机会
bash
undefinedbash
undefinedBasic usage - find BTC/USDT arb opportunities
Basic usage - find BTC/USDT arb opportunities
python scripts/find_arb_opps.py --base BTC --quote USDT
python scripts/find_arb_opps.py --base BTC --quote USDT
Include fungible tokens
Include fungible tokens
python scripts/find_arb_opps.py --base BTC,WBTC --quote USDT,USDC
python scripts/find_arb_opps.py --base BTC,WBTC --quote USDT,USDC
More examples
More examples
python scripts/find_arb_opps.py --base ETH,WETH --quote USDT,USDC,USD
python scripts/find_arb_opps.py --base SOL --quote USDT,USDC --min-spread 0.1
python scripts/find_arb_opps.py --base ETH,WETH --quote USDT,USDC,USD
python scripts/find_arb_opps.py --base SOL --quote USDT,USDC --min-spread 0.1
Filter by specific connectors
Filter by specific connectors
python scripts/find_arb_opps.py --base BTC --quote USDT --connectors binance,kraken,coinbase
undefinedpython scripts/find_arb_opps.py --base BTC --quote USDT --connectors binance,kraken,coinbase
undefinedStep 3: Analyze Results
步骤3:分析结果
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
脚本选项
bash
python scripts/find_arb_opps.py --help| Option | Description |
|---|---|
| Base token(s), comma-separated (e.g., BTC,WBTC) |
| Quote token(s), comma-separated (e.g., USDT,USDC) |
| Filter to specific connectors (optional) |
| Minimum spread % to show (default: 0.0) |
| Output as JSON |
bash
python scripts/find_arb_opps.py --help| 选项 | 描述 |
|---|---|
| 基础代币,多个用英文逗号分隔(例如BTC,WBTC) |
| 计价代币,多个用英文逗号分隔(例如USDT,USDC) |
| 筛选特定连接器(可选) |
| 展示的最小价差百分比(默认值:0.0) |
| 以JSON格式输出 |
Output Example
输出示例
Arbitrage Opportunities: BTC vs USDT
=====================================
Prices Found:
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
Best Opportunities:
Buy okx BTC-USDT @ $67,198.00
Sell coinbase BTC-USD @ $67,312.25
Spread: 0.17% ($114.25)Arbitrage Opportunities: BTC vs USDT
=====================================
Prices Found:
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
Best Opportunities:
Buy okx BTC-USDT @ $67,198.00
Sell coinbase BTC-USD @ $67,312.25
Spread: 0.17% ($114.25)Environment Variables
环境变量
bash
export HUMMINGBOT_API_URL=http://localhost:8000
export USERNAME=admin
export PASSWORD=adminScripts check for in: → →
.env./hummingbot-api/.env~/.hummingbot/.env.envbash
export HUMMINGBOT_API_URL=http://localhost:8000
export USERNAME=admin
export PASSWORD=admin脚本会按以下顺序查找文件: → →
.env./hummingbot-api/.env~/.hummingbot/.env.envRequirements
依赖要求
- Hummingbot API running
- Exchange connectors configured with API keys
- 已运行Hummingbot API
- 已配置带API密钥的交易所连接器