← 返回
数据分析 Key 中文

Congress Trades Tracker

Track US congress member and politician stock trades in real-time using the Quiver Quant API. Syncs trades to a local SQLite database, detects new significan...
使用Quiver Quant API实时追踪美国国会议员及政客的股票交易。将交易同步至本地SQLite数据库,检测新的重大...
armax
数据分析 clawhub v1.1.4 1 版本 99824.7 Key: 需要
★ 0
Stars
📥 1,139
下载
💾 21
安装
1
版本
#latest

概述

Congress Trades Tracker

Monitor US congressional stock trades via Quiver Quant API, store in a local SQLite database, and alert on new significant trades. Requires Python requests library and a Quiver Quant API key.

Requirements

  • Python 3.10+ with requests (pip install requests)
  • QUIVER_API_KEY environment variable (get a key at https://www.quiverquant.com/)

Environment Variables

VariableRequiredDefaultDescription
------------
QUIVER_API_KEYYesQuiver Quant API token
CONGRESS_DB_PATHNodata/congress_trades.dbSQLite database path
MIN_TRADE_AMOUNTNo15001Minimum trade amount to trigger alerts

Set these in your shell profile, .env file, or cron environment. Never hard-code API keys in the script.

Setup

1. Install Python dependency

pip install requests

2. Set your API key

export QUIVER_API_KEY="your-api-key-here"

3. Schedule with user cron (no sudo needed)

Add your env vars to ~/.profile or a .env file sourced by your shell, then add the cron entry:

crontab -e
# Add this line (uses env vars from your profile):
* * * * * . "$HOME/.profile" && /usr/bin/python3 /path/to/scripts/scraper.py >> /path/to/logs/scraper.log 2>&1

Never inline API keys directly in crontab entries.

4. Set up OpenClaw alert pickup

Add to your HEARTBEAT.md:

## Check for congress trade alerts
- Read `congress_trades/data/pending_congress_alert.txt` — if it has content, send the alert to the user, then delete the file.

Or create an OpenClaw cron job (every 5 min) to check and forward alerts.

How It Works

  1. Scraper runs every minute, fetches latest 200 trades from api.quiverquant.com
  2. Inserts into local SQLite with unique trade_key deduplication
  3. First run initializes DB and reports newest trade
  4. Subsequent runs detect new trades, filter to buys/sells above threshold
  5. Writes formatted alert to data/pending_congress_alert.txt for OpenClaw pickup
  6. Keeps last 50 alerts in data/new_trades.json

Network and Data

  • Only outbound connection: api.quiverquant.com (Quiver Quant API)
  • Storage: local SQLite file + JSON alert files in data/
  • No external endpoints besides the Quiver API
  • Restrict file permissions on data directory (chmod 700 data/)

Alert Format

🏛️ 3 new congress trade(s) detected:

🟢 PURCHASE: Nancy Pelosi (D) [Rep]
   $NVDA — $1,000,001 - $5,000,000
   Trade: 2026-02-10 | Reported: 2026-02-14

🔴 SALE: Dan Crenshaw (R) [Rep]
   $MSFT — $15,001 - $50,000
   Trade: 2026-02-09 | Reported: 2026-02-14

Customization

  • MIN_TRADE_AMOUNT: raise/lower via env var to change alert threshold
  • Fetch limit: change limit=200 in fetch_trades() for broader sweeps
  • Cron frequency: reduce to every 5 or 15 minutes if you prefer less polling

版本历史

共 1 个版本

  • v1.1.4 当前
    2026-03-29 05:50 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,458
data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 60,009
data-analysis

Stock Analysis

udiedrichsen
{"answer":"基于雅虎财经数据,分析股票与加密货币。支持投资组合管理、自选股预警、股息分析、8维评分、热门趋势扫描及传闻/早期信号探测。适用于股票分析、持仓追踪、财报异动、加密监控、热门股追踪或提前发掘非主流传闻。"}
★ 270 📥 56,967