2.7k★by mainfraame
clawback – OpenClaw Skill
clawback is an OpenClaw Skills integration for coding workflows. Mirror congressional stock trades with automated broker execution and risk management
Skill Snapshot
| name | clawback |
| description | Mirror congressional stock trades with automated broker execution and risk management OpenClaw Skills integration. |
| owner | mainfraame |
| repository | mainfraame/etrade-pelosi-bot |
| language | Markdown |
| license | MIT |
| topics | |
| security | L1 |
| install | openclaw add @mainfraame/etrade-pelosi-bot |
| last updated | Feb 7, 2026 |
Maintainer

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
- Telegram 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
ClawBack - Congressional Trade Mirror Bot
Overview
Automated trading application that mirrors congressional stock trades using broker APIs, scaling trade amounts relative to account size. Includes comprehensive congressional trade data collection from official government sources.
Architecture
Core Trading Components:
- Congressional Tracker - Fetches trade data from Senate and House official disclosures
- Broker Adapter - Handles authentication and trading operations (E*TRADE adapter included)
- Account Monitor - Tracks account balance and positions
- Trade Calculator - Scales congressional trades to user's account size
- Execution Engine - Places and manages orders
- Safety Controller - Implements risk management and failsafes
Congressional Data System:
- Data Sources - Official Senate eFD and House Clerk disclosures
- Alert Manager - Sends alerts for significant trades via Telegram
- Cron Scheduler - Automated daily data collection (9 AM weekdays)
- Broker Integration - Creates trading recommendations from alerts
Data Flow:
-
Daily Collection (9 AM weekdays):
- Fetch congressional trade data from official sources
- Parse PDFs (House Clerk) and scrape Senate eFD
- Generate alerts for significant trades (>$50K)
-
Trading Pipeline:
- Process congressional trade alerts
- Calculate scaled trade amounts based on account balance
- Validate trades (risk checks, market hours)
- Place orders via broker API
- Monitor execution and update positions
Configuration
Main Configuration (config/config.json):
- Broker API credentials (generic naming supports multiple brokers)
- Trade scaling ratio (percentage of account to allocate)
- Risk limits (max position size, stop losses)
- Trading hours restrictions
Congressional Data Configuration (config/congress_config.json):
- Data source settings (Senate, House)
- Politician tracking list (Pelosi, Crenshaw, Tuberville, Greene)
- Alert thresholds and Telegram settings
- Cron schedule and data retention
Safety Features
- Maximum position size limits
- Daily loss limits
- Market hours validation
- Manual override capability
- Comprehensive logging and monitoring
- Alert system for significant trades
Congressional Data System Features
Automated Data Collection:
- Schedule: Weekdays at 9 AM EST (configurable)
- Sources: Official Senate eFD and House Clerk disclosures
- Politicians: Track specific politicians or all
- Thresholds: Minimum trade size filtering
Alert System:
- Telegram Integration: Instant notifications
- Broker Integration: Automated trading recommendations
- Thresholds: Configurable trade size alerts (>$50K default)
Quick Start
1. Install Dependencies:
cd clawback
pip3 install -r requirements.txt
2. Configure Secrets:
# Run interactive setup
python3 src/config_loader.py setup
# Or manually edit secrets
nano config/secrets.json
3. Authenticate with Broker:
# Run interactive mode
python3 src/main.py interactive
# Select option 1 to authenticate
4. Set Up Automation:
# Install cron jobs
./scripts/setup_cron.sh
5. Run the System:
# Check for new trades
./scripts/run_bot.sh check
# Monitor stop-losses
./scripts/run_bot.sh monitor
# Run both
./scripts/run_bot.sh full
Documentation
- Congressional Data System: docs/CONGRESSIONAL_DATA.md
- Skill Documentation: SKILL.md
Monitoring & Maintenance
Logs:
logs/trading.log- Main trading logdata/congress_trades/- Congressional trade data
Maintenance:
- Daily: Check logs and alerts
- Weekly: Review statistics and performance
- Monthly: Clean up old data and update configurations
Security Considerations
- API keys stored in
config/secrets.json(git-ignored) - Environment variable substitution for sensitive values
- No personal information beyond public disclosures
- Rate limiting for web scraping
Supported Brokers
ClawBack uses an adapter pattern for broker integration. Each broker implements the 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 |
Support & Troubleshooting
- Check logs in
logs/directory - Review configuration files
- Test individual components
- Consult documentation
Version: 1.0.0 Last Updated: January 2026 Compatibility: Python 3.8+
Permissions & Security
Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.
Requirements
- OpenClaw CLI installed and configured.
- Language: Markdown
- License: MIT
- Topics:
Configuration
ClawBack reads secrets from environment variables or `config/secrets.json`: ```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: ```json { "broker": { "adapter": "etrade", "credentials": { "apiKey": "${BROKER_API_KEY}", "apiSecret": "${BROKER_API_SECRET}" } } } ```
FAQ
How do I install clawback?
Run openclaw add @mainfraame/etrade-pelosi-bot in your terminal. This installs clawback into your OpenClaw Skills catalog.
Does this skill run locally or in the cloud?
OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.
Where can I verify the source code?
The source repository is available at https://github.com/openclaw/skills/tree/main/skills/mainfraame/etrade-pelosi-bot. Review commits and README documentation before installing.
