mcpField
F
finding-arbitrage-opportunities

finding-arbitrage-opportunities

github.com/jeremylongshore其他2.9k91 次安装2 天前更新
代码仓库

关于 finding-arbitrage-opportunities

用于发现和分析中心化交易所、DEX 与不同区块链间加密货币套利机会的命令行技能。它会估算扣费后的收益,并支持监控和导出 JSON,供分析或机器人集成。

主要功能

  1. 01比较 CEX 与 DEX 价格
  2. 02估算扣费后的收益
  3. 03发现三角及跨链路径
  4. 04监控价差并发送提醒
  5. 05将结果导出为 JSON

适用场景

  1. 01比较不同交易所的 ETH/USDC 价格
  2. 02查找单一交易所内的三角套利机会
  3. 03追踪跨链稳定币价差
  4. 04导出扫描结果以集成交易机器人

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill finding-arbitrage-opportunities

安装后在 Claude Code 中输入/finding-arbitrage-opportunities确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

ARD.md
PRD.md
config/
settings.yaml
references/
errors.md
examples.md
implementation.md
scripts/
arb_finder.py
formatters.py
opportunity_scanner.py
price_fetcher.py
profit_calculator.py
triangular_finder.py

详细介绍

寻找套利机会

概述

检测并分析加密货币交易所和 DeFi 协议中的套利机会。汇总 CEX 和 DEX 来源的价格,计算扣除手续费后的净利润,并识别直接套利、三角套利和跨链套利路径。

前提条件

  • Python 3.9+,以及 httpx、rich 和 networkx 软件包
  • 可访问互联网以调用 API(基本使用无需 API 密钥)
  • 可选:交易所 API 密钥,用于访问实时订单簿
  • 了解套利概念和交易手续费

说明

  1. 快速价差扫描,针对特定交易对:

    python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py scan ETH USDC
    

    显示各交易所的当前价格、价差百分比、扣除手续费后的预估利润,以及建议操作。

  2. 多交易所比较,针对指定交易所:

    python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py scan ETH USDC \
      --exchanges binance,coinbase,kraken,kucoin,okx
    
  3. DEX 价格比较,跨去中心化交易所:

    python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py scan ETH USDC --dex-only
    

    比较 Uniswap V3、SushiSwap、Curve、Balancer,并估算 Gas 成本。

  4. 三角套利发现,在单个交易所内:

    python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py triangular binance --min-profit 0.5
    
  5. 跨链机会,跨不同区块链:

    python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py cross-chain USDC \
      --chains ethereum,polygon,arbitrum
    
  6. 实时监控,并设置阈值提醒:

    python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py monitor ETH USDC \
      --threshold 0.5 --interval 5
    
  7. 导出机会,以便集成到机器人:

    python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py scan ETH USDC --output json > opportunities.json
    

输出

  • 快速模式(默认):最佳机会及利润预估、买入/卖出建议和风险等级
  • 详细模式(--detailed):所有交易所价格、手续费明细、滑点估算和历史价差背景
  • 监控模式:实时更新,并提供阈值提醒和趋势指标

交易所手续费表和输出格式示例,请参阅 ${CLAUDE_SKILL_DIR}/references/implementation.md。

错误处理

错误原因解决方法
受到速率限制API 请求过多降低轮询频率或添加 API 密钥
价格过时数据超过 10s标记警告;重试
无价差市场定价有效正常情况;尝试其他交易对
流动性不足交易规模超过订单簿深度减少交易规模

示例

快速 ETH/USDC 价差扫描 - 在所有 CEX 交易所中寻找最佳买入/卖出机会:

python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py scan ETH USDC

检测输出示例:

  ARB OPPORTUNITY: ETH/USDC
  Buy:  Binance  @ $3,198.50  |  Sell: Coinbase @ $3,214.20
  Spread: 0.49%  |  Net Profit (after fees): 0.29% ($9.27 per ETH)
  Risk: LOW  |  Confidence: HIGH  |  Window: ~30s

在 Binance 上进行三角套利 - 找出净利润至少为 0.5% 的循环路径:

python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py triangular binance --min-profit 0.5

跨链 USDC 机会 - 比较 L1/L2 链上的稳定币价格:

python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py cross-chain USDC --chains ethereum,polygon,arbitrum

计算确切利润 - 查看特定交易的详细手续费明细:

python ${CLAUDE_SKILL_DIR}/scripts/arb_finder.py calc \
  --buy-exchange binance --sell-exchange coinbase --pair ETH/USDC --amount 10  # 10 = trade size in ETH

资源

  • CoinGecko API - 免费价格数据
  • CCXT Library - 统一的交易所 API
  • Uniswap Subgraph - DEX 数据
  • ${CLAUDE_SKILL_DIR}/references/implementation.md - 交易所手续费表、配置、高级套利类型、免责声明

评论

支持 Markdown