6DuckLearn Skills

congress trades

Track U.S. Congress members' stock trades in real-time, making "smart political money" impossible to hide. Sync member trade disclosure data to a local SQLite database via the Quiver Quant API, allowing flexible queries by politician name, stock code, party, date range, and trade type. Large trades exceeding the configurable amount threshold (default $15,001) automatically trigger alerts, generating structured Alert files for real-time monitoring.

finance Tags: okx, trading, community, okx-marketplace, finance, trend

6DuckLearn provenance: Community skill by Cymiran, mirrored from the OKX Skills Marketplace (https://www.okx.com/en-sg/agent-tradekit/skills/congress-trades). It is not curated, verified, or endorsed by 6DuckLearn or represented as an official OKX publication.

Financial safety boundary: Never request secrets in chat. Before any external API call or action that places, cancels, or amends an order; changes leverage; transfers funds; creates or stops a bot; subscribes to or redeems an earn product; or signs/broadcasts a transaction, show the exact live/demo profile, instrument, side, size, price constraints, fees, and worst-case loss, then obtain explicit user approval. Default to read-only or demo mode when uncertain. Treat all analysis as research, not investment advice.

Congress Trades Tracker

Monitor US congressional stock trades via the Quiver Quant API. Syncs data to a local SQLite database and alerts on new significant trades.

Requirements

Environment Variables

Variable Required Default Description
QUIVER_API_KEY Yes -- Quiver Quant API token
CONGRESS_DB_PATH No data/congress_trades.db SQLite database path
MIN_TRADE_AMOUNT No 15001 Minimum trade dollar amount to trigger alerts

Never hard-code API keys in scripts or crontab entries. Use shell profile, .env file, or secure environment injection.

Execution Flow

When the user activates this skill, follow the steps below based on what they need.

1. First-Time Setup

If the user has not set up the tracker yet, guide them through:

  1. Check Python: Verify Python 3.10+ is available.
  2. Install dependency: pip install requests
  3. Set API key: Ask the user for their Quiver Quant API key. Instruct them to set it:
    export QUIVER_API_KEY="<their-key>"
    
  4. Run initial sync: Execute the scraper to populate the database:
    python3 scripts/scraper.py
    
  5. Confirm success: Check that data/congress_trades.db was created and report the number of trades synced.
  6. Optional -- schedule cron: Help the user set up a cron job for automatic syncing:
    crontab -e
    # Add (adjust paths). Every 30 min is sufficient — data updates once daily at most:
    */30 * * * * . "$HOME/.profile" && /usr/bin/python3 /path/to/scripts/scraper.py >> /path/to/logs/scraper.log 2>&1
    

2. Manual Sync

If the user asks to sync, refresh, or update trades:

  1. Run the scraper: python3 scripts/scraper.py
  2. Report the result: number of new trades found, total in database.

3. Query Trades

When the user wants to look up trades, use the SQLite database directly. The database is at the path defined by CONGRESS_DB_PATH (default: data/congress_trades.db).

Database schema (table trades):

Column Type Description
representative TEXT Politician name
party TEXT D, R, or I
house TEXT House or Senate
ticker TEXT Stock ticker symbol
transaction_type TEXT Purchase, Sale, etc.
transaction_date TEXT Date of trade (YYYY-MM-DD)
report_date TEXT Date reported (YYYY-MM-DD)
range_amount TEXT Dollar range (e.g., "$1,001 - $15,000")
description TEXT Additional details

Query by Politician

SELECT representative, ticker, transaction_type, range_amount, transaction_date
FROM trades
WHERE representative LIKE '%Pelosi%'
ORDER BY transaction_date DESC
LIMIT 20;

Query by Ticker

SELECT representative, party, transaction_type, range_amount, transaction_date
FROM trades
WHERE ticker = 'NVDA'
ORDER BY transaction_date DESC
LIMIT 20;

Query by Party

SELECT representative, ticker, transaction_type, range_amount, transaction_date
FROM trades
WHERE party = 'D'
ORDER BY transaction_date DESC
LIMIT 20;

Query by Date Range

SELECT representative, ticker, transaction_type, range_amount, transaction_date
FROM trades
WHERE transaction_date BETWEEN '2026-01-01' AND '2026-03-31'
ORDER BY transaction_date DESC;

Query by Transaction Type

SELECT representative, ticker, range_amount, transaction_date
FROM trades
WHERE transaction_type = 'Purchase'
ORDER BY transaction_date DESC
LIMIT 20;

Combined Query (e.g., Republican purchases in a date range)

SELECT representative, ticker, range_amount, transaction_date
FROM trades
WHERE party = 'R'
  AND transaction_type = 'Purchase'
  AND transaction_date >= '2026-01-01'
ORDER BY transaction_date DESC;

Summary Statistics

-- Most traded tickers
SELECT ticker, COUNT(*) as trade_count
FROM trades
GROUP BY ticker
ORDER BY trade_count DESC
LIMIT 10;

-- Most active politicians
SELECT representative, party, COUNT(*) as trade_count
FROM trades
GROUP BY representative
ORDER BY trade_count DESC
LIMIT 10;

-- Trades by party breakdown
SELECT party, transaction_type, COUNT(*) as count
FROM trades
GROUP BY party, transaction_type
ORDER BY party, count DESC;

4. Check Alerts

If the user asks about recent alerts or significant trades:

  1. Check data/pending_congress_alert.txt for the latest undelivered alert.
  2. Check data/new_trades.json for the last 50 alert records.
  3. Present the alert content to the user.
  4. Ask the user if they want to clear the alert. If yes, delete data/pending_congress_alert.txt to prevent re-alerting.

5. Change Configuration

If the user wants to adjust settings:

  • Threshold: export MIN_TRADE_AMOUNT=50001 (or any dollar amount)
  • Database path: export CONGRESS_DB_PATH=/custom/path/trades.db
  • Cron frequency: Edit crontab to change interval (e.g., */15 for every 15 minutes)

Output Templates

Trade List Output

When displaying trade results, use this format:

Congress Trades: [query description]
Found [N] trades.

| Politician | Party | Ticker | Type | Amount Range | Trade Date |
|---|---|---|---|---|---|
| Nancy Pelosi | D | NVDA | Purchase | $1,000,001 - $5,000,000 | 2026-02-10 |
| Dan Crenshaw | R | MSFT | Sale | $15,001 - $50,000 | 2026-02-09 |

Alert Output

New Congress Trade Alert -- [N] significant trade(s) detected:

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

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

Summary Statistics Output

Congress Trades Summary:
- Total trades in database: [N]
- Date range: [earliest] to [latest]
- Most traded ticker: [TICKER] ([count] trades)
- Most active politician: [Name] ([count] trades)
- Party breakdown: D: [n], R: [n], I: [n]

Setup Confirmation Output

Congress Trades Tracker -- Setup Complete
- Database: [path] ([N] trades synced)
- API: Quiver Quant connected
- Threshold: $[amount] minimum for alerts
- Cron: [status]

Error Handling

When issues occur, diagnose and guide the user:

Error Cause Resolution
QUIVER_API_KEY environment variable is required API key not set Ask user to set export QUIVER_API_KEY="..."
401 Unauthorized Invalid or expired API key Ask user to verify key at quiverquant.com
403 Forbidden API plan does not include congress data Suggest upgrading Quiver Quant plan
Connection error / timeout Network issue or API down Retry in a few minutes; check internet
No trades returned API returned empty response May be temporary; data updates on reporting schedule
Database locked Concurrent access to SQLite Ensure only one scraper instance runs at a time
ModuleNotFoundError: requests Missing dependency Run pip install requests

Security Notes

  • API key is read from environment variable only — never store it in scripts or crontab
  • Restrict file permissions on data directory: chmod 700 data/
  • Only outbound connection: api.quiverquant.com (HTTPS)

Related skills

  • alpha vantage — Cross-asset analysis is its unique advantage—it can simultaneously pull macro data such as the S&P 500, gold, the dollar index, Federal Reserve interest rates, CPI, GDP, etc., allowing one to see at a glance whether "BTC is moving with risk assets today or pricing independently." In conjunction with the OKX Trade Kit, Alpha Vantage is responsible for in-depth historical and macroeconomic context, while OKX provides real-time prices, funding rates, and order book data, with both complementing each other to form a complete analysis chain.
  • apex crypto intelligence — AI-driven multi-exchange cryptocurrency market analysis, arbitrage detection, and hedge fund-level trading reports using real-time data from major exchanges.
  • btc altcoin market pulse — Fetches live OKX market data across Bitcoin and major altcoins, analyzes price momentum, funding rates, open interest, and BTC dominance signals to produce a structured BTC + Altcoin Market Pulse report.
  • cmc okx — CoinMarketCap × OKX dual engine, a one-stop solution for all your cryptocurrency market data needs. CMC provides market cap, supply, dominance, holding distribution, project background, and macro event calendar; the OKX Trade Kit complements with real-time prices, funding rates, open interest, 70+ technical indicators, and order book depth, with both automatically linked and mutually supportive. It supports natural language triggers, whether you ask "What’s the price of Bitcoin?", "How to read the ETH daily chart?" or "Which coin is surging?", Skill automatically recognizes intent, selects tool combinations, outputs structured tables, and includes a "Quick Take" one-sentence summary.
  • crypto research — A systematic cryptocurrency due diligence report, covering everything from price to holding distribution, from technical aspects to a red flag checklist, all in one go. Integrating the OKX Trade Kit (real-time prices, 70+ technical indicators, funding rates, open interest, order book depth) with CoinMarketCap (market cap, token economics, whale distribution, news sentiment), a seven-step research process is executed in parallel, covering market snapshots, technical analysis, derivatives data, project fundamentals, and recent news. The analysis framework specifically distinguishes between legitimate projects and Meme coins, evaluating key signals such as whale concentration, holder trends, 200-day moving average positions, and funding rate extremes, ultimately outputting a green flag/red flag checklist and low/medium/high/very high risk ratings.
  • hyperliquid analyzer — Analyze Hyperliquid market data to provide trading insights, covering six major analysis modes: capturing trading whales, automatic monitoring and push notifications of on-chain whale positions, order wall scanning, on-chain position analysis, HL and OKX funding fee sentiment analysis, and on-chain and off-chain price difference scanning. Use on-chain signals to assist your CEX trading.