Members of Congress have to report their stock trades under the STOCK Act. The data is public, but it is spread across two government websites with different formats: the Senate's eFD system and the House Clerk's PDF filings. If you have ever tried to answer "which politicians bought NVDA this quarter?", you know it takes an afternoon.
This tutorial shows how to get every trade from both chambers as one clean table in about ten lines of Python, then go a step further: flag the trades where a member sits on a committee that oversees the company's industry.
What you will build
- A script that pulls every disclosed trade from the last 90 days
- A filter for one ticker, one politician, or large trades only
- A "conflict" view: Armed Services members trading defense stocks, Energy committee members trading oil companies, and so on
- An optional daily alert for new trades
The data source
We will use the Congress Stock Trades API on Apify. It reads the official Senate and House disclosures directly, so there is no third-party scraper in between, and returns one row per trade:
| Field | Example |
|---|---|
politician, chamber, state
|
Jane Q. Public, House, CA |
ticker, assetName
|
GOOGL, Alphabet Inc. - Class A |
transactionType |
Purchase / Sale / Exchange |
transactionDate, disclosureDate
|
2026-09-01, 2026-09-16 |
reportingLagDays |
15 |
amountRange, amountMin, amountMax
|
$250,001 - $500,000 |
committees, sector, committeeOversight
|
the member's committees, the company's sector, and whether they overlap |
filingUrl |
link to the original disclosure |
Pricing is pay per result ($5 per 1,000 trades), and Apify's free plan credit is enough to follow along.
Step 1: Install the client and get a token
pip install apify-client
Create a free Apify account, then copy your API token from Settings → API & Integrations. Store it in an environment variable rather than in your code:
export APIFY_TOKEN="your-token-here"
Step 2: Pull the last 90 days of trades
import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("smartmoney-data/congress-stock-trades-tracker").call(
run_input={"lookbackDays": 90}
)
trades = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(len(trades), "trades")
for t in trades[:5]:
print(t["politician"], t["transactionType"], t["ticker"], t["amountRange"])
Step 3: Filter by ticker, politician or size
Every filter runs before you are charged, so narrow inputs are also cheaper:
run = client.actor("smartmoney-data/congress-stock-trades-tracker").call(
run_input={
"tickers": ["NVDA", "MSFT"], # only these stocks
"politicians": [], # e.g. ["Pelosi"] for one member
"transactionTypes": ["purchase"], # purchase, sale, exchange
"minAmountUsd": 50000, # skip the $1,001 - $15,000 bucket
"lookbackDays": 180,
}
)
Step 4: Find committee conflicts
This is the part most trackers skip. Each trade is enriched with the member's committee assignments and the company's sector (from its SEC industry code). committeeOversight is true when they overlap, for example an Armed Services member trading a defense contractor.
run = client.actor("smartmoney-data/congress-stock-trades-tracker").call(
run_input={"lookbackDays": 180, "onlyCommitteeOversight": True}
)
for t in client.dataset(run["defaultDatasetId"]).iterate_items():
print(f'{t["politician"]:<25} {t["ticker"]:<6} {t["transactionType"]:<9} '
f'{t["amountRange"]:<22} via {", ".join(t["oversightCommittees"])}')
A note on interpretation: an overlap is not evidence of wrongdoing. Many members hold diversified portfolios and trades are often made by spouses or advisers. The flag tells you where to look, and the filingUrl takes you to the original disclosure.
Step 5: Load into pandas
import pandas as pd
df = pd.DataFrame(trades)
summary = (df[df.transactionType == "Purchase"]
.groupby("ticker")
.agg(buyers=("politician", "nunique"), max_amount=("amountMax", "sum"))
.sort_values("buyers", ascending=False)
.head(10))
print(summary)
reportingLagDays is worth a look too: the law allows 45 days, and late filers show up immediately.
Step 6: Get alerts on new trades
Two options:
- Schedule it in Apify Console (daily is plenty, since disclosures arrive in batches) and connect the Slack, email or webhook integration.
- Use Smart Money Alerts, which remembers what it already sent and only notifies you about new trades, insider buys or activist stakes on your watchlist.
Use it from an AI assistant
The same data is available to Claude, ChatGPT or Cursor through the Apify MCP server. Add this URL as a remote MCP server or custom connector:
https://mcp.apify.com/?tools=smartmoney-data/congress-stock-trades-tracker
Then ask: "Which members of Congress traded defense stocks in the last 90 days, and do any of them sit on Armed Services?"
FAQ
How current is the data? Members must report within 45 days of a trade, so the data is as fresh as the filings. The actor reads new disclosures every run.
Does it include spouses and dependents? Yes. The owner field says whether the trade was the member's, a spouse's, or a dependent child's.
Is this legal to use? Yes. STOCK Act disclosures are public records published by Congress.
Data is for informational purposes only and is not investment advice.
Top comments (0)