find-xemm-opps
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesefind-xemm-opps
寻找XEMM机会
Find Cross-Exchange Market Making (XEMM) opportunities by analyzing order book depth and liquidity across connected exchanges.
XEMM involves quoting on one exchange (the maker side) while hedging fills on another (the taker/hedge side). The best opportunities exist where:
- One exchange has a wide spread and thin book (maker side — room to quote profitably)
- Another has a tight spread and deep book (taker side — cheap to hedge)
- A mid-price difference exists between them
通过分析已连接交易所的订单簿深度和流动性,寻找跨交易所做市(XEMM)机会。
XEMM策略包括在一个交易所(maker方)报价,同时在另一个交易所(taker/对冲方)对冲成交订单。最佳机会出现在以下场景:
- 某一交易所拥有宽点差和薄订单簿(maker方——存在可盈利报价的空间)
- 另一交易所拥有窄点差和厚订单簿(taker方——对冲成本低廉)
- 两者之间存在中间价差异
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 Pair
步骤1:定义交易对
bash
undefinedbash
undefinedScan for SOL/USDT XEMM opportunities
扫描SOL/USDT的XEMM机会
python scripts/find_xemm_opps.py --base SOL --quote USDT
python scripts/find_xemm_opps.py --base SOL --quote USDT
Include fungible equivalents
包含可替代等价代币
python scripts/find_xemm_opps.py --base ETH,WETH --quote USDT,USDC
python scripts/find_xemm_opps.py --base ETH,WETH --quote USDT,USDC
Filter to specific connectors
筛选特定交易所连接器
python scripts/find_xemm_opps.py --base BTC --quote USDT --connectors binance,kraken,coinbase,okx
python scripts/find_xemm_opps.py --base BTC --quote USDT --connectors binance,kraken,coinbase,okx
Minimum mid-price spread between exchanges (default: 0.0%)
交易所间最低中间价点差(默认:0.0%)
python scripts/find_xemm_opps.py --base SOL --quote USDC --min-spread 0.05
undefinedpython scripts/find_xemm_opps.py --base SOL --quote USDC --min-spread 0.05
undefinedStep 2: Interpret Results
步骤2:解读结果
The script outputs a market overview table and ranked XEMM opportunity pairs:
====================================================================
XEMM Opportunities — SOL / USDC
Order book depth: 20 levels | Sources: 18
====================================================================
Exchange Pair Mid Spread Bid Depth Ask Depth B/A
---------------------- -------------- ---------- -------- ------------ ------------ ------
bitstamp SOL-USDC $87.45 0.120% $23.4K $18.9K 1.24
binance SOL-USDT $87.51 0.015% $412.0K $389.0K 1.06
okx SOL-USDT $87.56 0.023% $287.0K $301.0K 0.95
...
Top XEMM Opportunities (MAKER → hedge on TAKER):
----------------------------------------------------------------
#1 Score: 8.42
MAKER bitstamp $87.45 spread 0.120% depth $42.3K
TAKER binance $87.51 spread 0.015% depth $801.0K
Mid-price gap: 0.0686% | Spread ratio: 8.0x | Depth ratio: 18.9xColumns explained:
| Column | Description |
|---|---|
| Mid | Mid-price between best bid and ask |
| Spread | Bid-ask spread as % of mid |
| Bid/Ask Depth | Total quote value of top-N order book levels |
| B/A | Bid-to-ask depth ratio (>1 = more buy pressure) |
| Spread ratio | Maker spread ÷ taker spread — higher = better maker edge |
| Depth ratio | Taker depth ÷ maker depth — higher = better hedge liquidity |
脚本会输出市场概览表格和排名靠前的XEMM机会交易对:
====================================================================
XEMM Opportunities — SOL / USDC
Order book depth: 20 levels | Sources: 18
====================================================================
Exchange Pair Mid Spread Bid Depth Ask Depth B/A
---------------------- -------------- ---------- -------- ------------ ------------ ------
bitstamp SOL-USDC $87.45 0.120% $23.4K $18.9K 1.24
binance SOL-USDT $87.51 0.015% $412.0K $389.0K 1.06
okx SOL-USDT $87.56 0.023% $287.0K $301.0K 0.95
...
Top XEMM Opportunities (MAKER → hedge on TAKER):
----------------------------------------------------------------
#1 Score: 8.42
MAKER bitstamp $87.45 spread 0.120% depth $42.3K
TAKER binance $87.51 spread 0.015% depth $801.0K
Mid-price gap: 0.0686% | Spread ratio: 8.0x | Depth ratio: 18.9x列说明:
| 列名 | 描述 |
|---|---|
| Mid | 最优买价和卖价之间的中间价 |
| Spread | 买卖点差占中间价的百分比 |
| Bid/Ask Depth | 前N档订单簿的总报价价值 |
| B/A | 买盘深度与卖盘深度的比率(>1表示买盘压力更大) |
| Spread ratio | Maker点差 ÷ Taker点差 —— 数值越高,Maker方优势越大 |
| Depth ratio | Taker深度 ÷ Maker深度 —— 数值越高,对冲流动性越好 |
Script Options
脚本选项
| Option | Description |
|---|---|
| Base token(s), comma-separated (e.g., ETH,WETH) |
| Quote token(s), comma-separated (e.g., USDT,USDC) |
| Filter to specific connectors (optional) |
| Order book depth per exchange (default: 20) |
| Minimum mid-price spread % between exchanges (default: 0.0) |
| Include btc_markets (Australian residents only) |
| Include ndax (Canadian residents only) |
| Output as JSON |
| 选项 | 描述 |
|---|---|
| 基础代币(可逗号分隔,例如:ETH,WETH) |
| 报价代币(可逗号分隔,例如:USDT,USDC) |
| 筛选特定交易所连接器(可选) |
| 每个交易所的订单簿深度(默认:20) |
| 交易所间最低中间价点差百分比(默认:0.0) |
| 包含btc_markets(仅澳大利亚居民可用) |
| 包含ndax(仅加拿大居民可用) |
| 以JSON格式输出 |
Environment Variables
环境变量
bash
export HUMMINGBOT_API_URL=http://localhost:8000
export API_USER=admin
export API_PASS=adminScripts check for in: → →
.env./hummingbot-api/.env~/.hummingbot/.env.envbash
export HUMMINGBOT_API_URL=http://localhost:8000
export API_USER=admin
export API_PASS=admin脚本会在以下路径查找文件: → →
.env./hummingbot-api/.env~/.hummingbot/.env.envRequirements
要求
- Hummingbot API running
- At least 2 exchange connectors configured with API keys
- 运行中的Hummingbot API
- 至少配置了2个带有API密钥的交易所连接器