ClawBack:自动镜像国会议员股票交易 - Openclaw Skills

作者:互联网

2026-04-13

AI快讯

什么是 ClawBack?

ClawBack 是一款专业级交易自动化工具,旨在镜像美国国会领导人的投资活动。通过与 Openclaw Skills 生态系统集成,它为散户投资者提供了通常归功于z治内部人士的数据驱动优势。该技能通过爬取众议院和参议院的官方披露文件、分析交易模式并通过经纪商 API 执行仓位来工作。它是为那些希望拥有可靠、自托管解决方案以跟随z治交易信号并内置安全防护的开发者而构建的。

该工具特别有价值,因为它使历史上让国会领导人跑赢标普 500 指数的信息获取变得民主化。通过在 Openclaw Skills 框架内利用此技能,用户可以自动化坚控 PDF 备案和网络披露的繁琐过程,将立法透明度转化为可操作的财务策略。

下载入口:https://github.com/openclaw/skills/tree/main/skills/mainfraame/etrade-pelosi-bot

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install etrade-pelosi-bot

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 etrade-pelosi-bot。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

ClawBack 应用场景

  • 自动复制表现优异的国会议员的投资组合。
  • 对国会信号实施机构级风险管理,如移动止损。
  • 在 Openclaw Skills 环境中建立z治交易活动的本地数据库以进行量化分析。
  • 通过自动化减少公开披露与交易执行之间的时间延迟。
ClawBack 工作原理
  1. 系统触发对众议院shu记员(PDF 解析)和参议院 eFD(Selenium)数据库的爬取,以发现新备案。
  2. 原始披露数据被解析为结构化格式,以识别股票代码、交易类型和交易金额。
  3. 交易引擎根据您的策略设置(如入场延迟和持有期)评估信号。
  4. 仓位根据您的账户余额进行缩放,并通过特定经纪商适配器(如 E*TRADE)执行。
  5. 后台程序坚控活跃交易,执行止损和移动获利规则。

ClawBack 配置指南

要将此技能部署为 Openclaw Skills 集合的一部分,请按照以下安装步骤操作:

# 克隆仓库
git clone https://github.com/openclaw/clawback
cd clawback

# 初始化环境和依赖
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

# 运行配置加载程序以设置密钥
python3 src/config_loader.py setup

# 在交互模式下通过经纪商进行身份验证
python3 src/main.py interactive

# 通过 cron 启用自动交易周期
./scripts/setup_cron.sh

ClawBack 数据架构与分类体系

ClawBack 使用结构化方法组织其运营数据,以确保 Openclaw Skills 生态系统的一致性:

组件 格式 描述
trading.db SQLite 交易历史、仓位追踪和元数据的主数据库。
secrets.json JSON 安全存储 BROKER_API_KEY、BROKER_ACCOUNT_ID 和 T@elegrimm 令牌。
config.json JSON 集中化的策略参数,包括仓位大小和止损限制。
congress_tracker Scraper 从众议院 PTR 和参议院 eFD 来源提取数据的逻辑。
name: clawback
description: Mirror congressional stock trades with automated broker execution and risk management
version: 1.0.0
author: dayne
metadata:
  openclaw:
    requires:
      - python3
      - pdfplumber
      - selenium
      - yfinance
    config:
      - BROKER_API_KEY
      - BROKER_API_SECRET
      - BROKER_ACCOUNT_ID
    optional_config:
      - TELEGRAM_BOT_TOKEN
      - TELEGRAM_CHAT_ID

ClawBack

Mirror congressional stock trades with automated broker execution

ClawBack tracks stock trades disclosed by members of Congress (House and Senate) and executes scaled positions in your brokerage account. Built on the premise that congressional leaders consistently outperform the market due to informational advantages.

Features

  • Real-time disclosure tracking from official House Clerk and Senate eFD sources
  • Automated trade execution via broker API (E*TRADE adapter included)
  • Smart position sizing - scales trades to your account size
  • Trailing stop-losses - lock in profits, limit losses
  • Risk management - drawdown limits, consecutive loss protection
  • T@elegrimm notifications - get alerts for new trades and stop-losses
  • Backtesting engine - test strategies on historical data

Performance (Backtest Results)

Strategy Win Rate Return Sharpe
3-day delay, 30-day hold 42.9% +6.2% 0.39
9-day delay, 90-day hold 57.1% +4.7% 0.22

Congressional leaders have outperformed the S&P 500 by 47% annually according to NBER research.

Quick Start

# Clone and setup
git clone https://github.com/openclaw/clawback
cd clawback
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

# Configure secrets
python3 src/config_loader.py setup

# Authenticate with broker
python3 src/main.py interactive
# Select option 1 to authenticate

# Set up automation
./scripts/setup_cron.sh

Configuration

ClawBack reads secrets from environment variables or config/secrets.json:

{
  "BROKER_API_KEY": "your-broker-api-key",
  "BROKER_API_SECRET": "your-broker-api-secret",
  "BROKER_ACCOUNT_ID": "your-account-id",
  "TELEGRAM_BOT_TOKEN": "optional-for-notifications",
  "TELEGRAM_CHAT_ID": "optional-for-notifications"
}

Supported Brokers

ClawBack uses an adapter pattern for broker integration. Each broker implements a common interface defined in broker_adapter.py.

Broker Adapter Status
E*TRADE etrade_adapter.py Supported
Schwab schwab_adapter.py Planned
Fidelity fidelity_adapter.py Planned

To specify which broker to use, set broker.adapter in your config:

{
  "broker": {
    "adapter": "etrade",
    "credentials": {
      "apiKey": "${BROKER_API_KEY}",
      "apiSecret": "${BROKER_API_SECRET}"
    }
  }
}

Data Sources

All data is scraped directly from official government sources:

Source Data Method
House Clerk House PTR filings PDF parsing
Senate eFD Senate PTR filings Selenium scraping

No third-party APIs required for congressional data.

Strategy Settings

Edit config/config.json to customize:

{
  "strategy": {
    "entryDelayDays": 3,
    "holdingPeriodDays": 30,
    "purchasesOnly": true,
    "minimumTradeSize": 50000
  },
  "riskManagement": {
    "positionStopLoss": 0.08,
    "trailingStopActivation": 0.10,
    "trailingStopPercent": 0.05,
    "maxDrawdown": 0.15
  }
}

Commands

# Interactive mode
python3 src/main.py interactive

# Single check cycle
python3 src/main.py run

# Scheduled trading
python3 src/main.py schedule 24

# Run backtest
python3 src/backtester.py

Cron Automation

# Install cron jobs
./scripts/setup_cron.sh

# Manual runs
./scripts/run_bot.sh check    # Check for new trades
./scripts/run_bot.sh monitor  # Check stop-losses
./scripts/run_bot.sh full     # Both

Architecture

clawback/
├── src/
│   ├── main.py              # Main entry point
│   ├── congress_tracker.py  # Congressional data collection
│   ├── trade_engine.py      # Trade execution & risk management
│   ├── broker_adapter.py    # Abstract broker interface
│   ├── etrade_adapter.py    # E*TRADE broker implementation
│   ├── database.py          # SQLite state management
│   └── config_loader.py     # Configuration handling
├── config/
│   ├── config.json          # Main configuration
│   └── secrets.json         # API keys (git-ignored)
├── scripts/
│   ├── run_bot.sh           # Cron runner
│   └── setup_cron.sh        # Cron installer
└── data/
    └── trading.db           # SQLite database

Risk Disclaimer

This software is for educational purposes only. Trading stocks involves substantial risk of loss. Past performance of congressional trades does not guarantee future results. The authors are not financial advisors. Use at your own risk.

License

MIT License - See LICENSE file


Built with ClawBack for the OpenClaw community