Recipes
A company's insider and congressional activity
Put a company's insider trades and the trades members of Congress disclosed in its stock on one timeline, with get_insider_trades and get_congress_trades.
Tools: get_insider_trades, get_congress_trades · Calls: 2
Ask an assistantLink to this section
Using Fundalyze, show NVIDIA's insider trades and any trades in NVIDIA stock disclosed by members of Congress, on one timeline, newest first. Separate open-market buys and sales from grants, option exercises and tax withholding, and give the filing link for each.
Or in codeLink to this section
activity.py
import os
import requests
BASE = "https://api.fundalyze.ai/api/public/v1"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['FUNDALYZE_API_KEY']}"
def call(tool, **params):
response = session.get(f"{BASE}/{tool}", params=params, timeout=60)
response.raise_for_status()
return response.json()["data"]
ticker = "NVDA"
insiders = call("get_insider_trades", ticker=ticker, limit=50)["trades"]
congress = call("get_congress_trades", ticker=ticker, limit=50)["trades"]
timeline = [
(t["transaction_date"] or t["filed_date"], "insider", t["owner"], t["code"], t["value_usd"], t["source_url"])
for t in insiders
if t["code"] in ("P", "S") # open-market buys and sales only
] + [
(t["transaction_date"] or t["filing_date"], "congress", t["member"], t["type"],
f'{t["amount_low_usd"]}-{t["amount_high_usd"] or "+"}', t["source_url"])
for t in congress
]
for date, who, name, kind, value, url in sorted(timeline, key=lambda row: row[0] or "", reverse=True):
print(date, who.ljust(8), (name or "").ljust(28), str(kind).ljust(9), value, url)Read it carefullyLink to this section
- Insider transaction codes tell routine from deliberate:
Pis an open-market purchase andSa sale;A(grant),M(option exercise),F(shares withheld for tax) andG(gift) are mostly mechanical. Rows without a code are holdings reports, not trades. - Congressional amounts are ranges as disclosed (for example $1,001 to $15,000), not exact values.
ownersays whose account it was: blank for the member,SPspouse,JTjoint,DCdependent child. - Disclosure lags differ. Insiders file a Form 4 within two business days; members of Congress have up to 45 days to report a trade. Sort by the trade date, as above, not the filing date.
- For short-selling interest in the same stock, add
get_short_interest, and keep FINRA's attribution line with its figures.
This page as Markdown, for language models and scripts: /developers/md/recipes/company-trading-activity