Score stocks based on US politician trade disclosures (Capitol Trades).
Project description
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 -e .
#Then run the CLI
## CLI usage
Fetch recent trades and score tickers:
```bash
poltrade --tickers AAPL TSLA --pages 50 --hold-length 180 --buy-weight 0.8 --details
--tickersOne or more tickers.--pagesNumber of pages to fetch from Capitol Trades (default 303 in the original).--hold-lengthLookback window in days for the date filter (default 180 in the original).--buy-weightWeight on buy-ratio in final score. Recency weight is1 - buy-weight.--detailsPrint 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 poltrade.data import gather_data
from poltrade.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_datafunction relies onpandas.read_htmlto scrapecapitoltrades.compages.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file politician_trade_score-2025.1.3.tar.gz.
File metadata
- Download URL: politician_trade_score-2025.1.3.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74172cac1533c043d5395bacbb1e826ba40e9693f8bbabd996552929ac1f9795
|
|
| MD5 |
33852417be2c4f763e9dfae6706b4fe5
|
|
| BLAKE2b-256 |
8ab99e50d6c7aedce4544c78f491bc10f7077dcf6f4c2eedd31371a26bf3a4e4
|
File details
Details for the file politician_trade_score-2025.1.3-py3-none-any.whl.
File metadata
- Download URL: politician_trade_score-2025.1.3-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cc6c19f56f1f0e8c75e79db97d044e7a269146be8b00a23ff53b82b2d07fb7f
|
|
| MD5 |
db7da6e69438486f26301f1e981d0051
|
|
| BLAKE2b-256 |
9963675217e31d676c30c829d08af04c00d22d7efcf3b924ba18d349e2f1b038
|