Skip to main content

Score stocks based on US politician trade disclosures (Capitol Trades).

Project description

politician-trade-score

Score stocks based on US politician trade disclosures (Capitol Trades).

This tool scrapes public politician trade data and computes a score for each ticker based on buy/sell activity and recency, helping identify potential signals.


Installation

pip install politician-trade-score

Install (editable)

pip install -e .

On Windows PowerShell

If PowerShell blocks virtual-environment activation, use this one-time PATH update to point pip and poltrade to your venv:

# from your project root
py -3.13 -m venv .venv
$env:Path = "$PWD\.venv\Scripts;$env:Path"
where python
where pip
pip install politician-trade-score

Then run the CLI.

CLI usage

Fetch recent trades and score tickers:

poltrade --tickers AAPL TSLA --pages 50 --hold-length 180 --buy-weight 0.8 --details
  • --tickers - One or more tickers.
  • --pages - Number of pages to fetch from Capitol Trades (default 303 in the original).
  • --hold-length - Lookback window in days for the date filter (default 180 in the original).
  • --buy-weight - Weight on buy-ratio in final score. Recency weight is 1 - buy-weight.
  • --details - Print the intermediate details shown by the original script.

You can also pass explicit start and end dates (YYYY-MM-DD) instead of --hold-length:

poltrade --tickers NVDA --start-date 2025-06-01 --end-date 2025-09-01

Library usage

from politician_trade_score.data import gather_data
from politician_trade_score.score import PoliticianTradeScorer

data = gather_data()
scorer = PoliticianTradeScorer(buy_ratio_weight=0.8, recency_weight=0.2)
score = scorer.final_score(data, "AAPL", details=True, tutorial=True)

Notes

  • The gather_data function relies on pandas.read_html to scrape capitoltrades.com pages.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

politician_trade_score-2025.1.4.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

politician_trade_score-2025.1.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file politician_trade_score-2025.1.4.tar.gz.

File metadata

File hashes

Hashes for politician_trade_score-2025.1.4.tar.gz
Algorithm Hash digest
SHA256 4c47e241602d0862957b32b590ee3107d324ef7c37fa91f284f188eb12740e98
MD5 cb138eb4930c535db6188cea3c8df773
BLAKE2b-256 15c89d9e7cd24d4087d17f4072b7f0843cdc3f336eb39d773aecb29feb7c9c0e

See more details on using hashes here.

File details

Details for the file politician_trade_score-2025.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for politician_trade_score-2025.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3aac8ef200a3f30c297774e163f17d14231db7d646c2ad469edf357c7f2ad495
MD5 75a857bec0e877e17986b3374a946f6d
BLAKE2b-256 59e1dc0494cb72ca1538b5beb8e4210b1adff520a30c04f3784d364a8fb9fb1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page