ilia d2ae095fcf
Some checks failed
CI / lint-and-test (push) Failing after 1m7s
CI / security-scan (push) Failing after 1m5s
CI / dependency-scan (push) Successful in 6m39s
CI / docker-build-test (push) Failing after 1m13s
CI / workflow-summary (push) Successful in 1m5s
Add complete Ansible integration configuration
NEW: Complete Ansible role for automated POTE deployment

Files Added:
============
📁 ansible/
├── README.md - Overview and usage
├── roles/pote/defaults/main.yml -  200+ variables defined
├── group_vars/
│   ├── all.yml - Common variables
│   ├── development.yml - Dev environment (branch: dev)
│   ├── staging.yml - QA environment (branch: qa)
│   └── production.yml - Prod environment (branch: main)
├── inventory.example.yml - Example inventory
└── vault.example.yml - Example secrets

📄 ANSIBLE_INTEGRATION.md - Complete integration guide

What Ansible Needs to Know:
============================
 Git repository & branch (per environment)
 Application user & paths
 Python & system dependencies
 Database configuration (per environment)
 Email/SMTP settings
 Monitoring configuration
 Cron/automation schedules
 Deployment options
 Security settings
 Feature flags
 Environment-specific overrides

Variable Categories (11):
==========================
1. Project basics (5 vars)
2. User & paths (7 vars)
3. Python & dependencies (3 lists)
4. Database (8 vars)
5. Email/SMTP (6 vars)
6. Monitoring (2 vars)
7. Logging (2 vars)
8. Cron/automation (7 vars)
9. Deployment (6 vars)
10. Security (4 vars)
11. Feature flags (4 vars)

Integration:
============
 Compatible with base_os role
 Multi-environment support (dev/qa/prod)
 Branch-based deployment (dev→qa→main)
 Ansible Vault for secrets
 Sensible defaults for everything
 Minimal required config (3 vars!)

Usage:
======
ansible-playbook deploy-pote.yml --limit development
ansible-playbook deploy-pote.yml --limit staging
ansible-playbook deploy-pote.yml --limit production

Ready for your Ansible auto-configure system!
2025-12-24 22:04:36 -05:00
2025-12-14 20:45:34 -05:00
2025-12-24 22:01:08 -05:00

POTE Public Officials Trading Explorer

Research-only tool for tracking and analyzing public stock trades by government officials.

⚠️ Important: This project is for personal research and transparency analysis only. It is NOT for investment advice or live trading.

What is this?

POTE tracks stock trading activity of government officials (starting with U.S. Congress) using lawfully available public data sources. It computes research metrics, descriptive signals, and risk/ethics flags to help understand trading patterns.

Key constraints

  • Public data only: House Stock Watcher (free!), yfinance (free!), QuiverQuant/FMP (optional)
  • Research framing: All outputs are descriptive analytics, not trading recommendations
  • No inside information claims: We use public disclosures that may be delayed or incomplete

Current Status

PR1 Complete: Project scaffold, DB models, price loader
PR2 Complete: Congressional trade ingestion (House Stock Watcher)
PR3 Complete: Security enrichment + deployment infrastructure
PR4 Complete: Phase 2 analytics - returns, benchmarks, performance metrics
45+ passing tests, 88%+ coverage

Quick start

🚀 Already deployed? See QUICKSTART.md for full usage guide!

📦 Deploying? See PROXMOX_QUICKSTART.md for Proxmox LXC deployment (recommended).

📧 Want automated reports? See AUTOMATION_QUICKSTART.md for email reporting setup!

Local Development

# Install
git clone <your-repo>
cd pote
make install
source venv/bin/activate

# Run migrations
make migrate

# Ingest sample data (offline, for testing)
python scripts/ingest_from_fixtures.py

# Enrich securities with company info
python scripts/enrich_securities.py

# With internet:
python scripts/fetch_congressional_trades.py
python scripts/fetch_sample_prices.py

# Run tests
make test

# Lint & format
make lint format

Production Deployment

# Proxmox LXC (Recommended - 5 minutes)
bash scripts/proxmox_setup.sh

# Docker
docker-compose up -d

Tech stack

  • Language: Python 3.10+
  • Database: PostgreSQL or SQLite (dev)
  • Data: House Stock Watcher (free!), yfinance (free!), QuiverQuant/FMP (optional)
  • Libraries: SQLAlchemy, Alembic, pandas, numpy, httpx, yfinance, scikit-learn
  • Testing: pytest (28 tests, 87%+ coverage)

Documentation

Getting Started:

Deployment:

Technical:

PR Summaries:

What's Working Now

  • SQLAlchemy models for officials, securities, trades, prices
  • Alembic migrations
  • Price loader with yfinance (idempotent, upsert)
  • Congressional trade ingestion from House Stock Watcher (FREE!)
  • Security enrichment (company names, sectors, industries)
  • ETL to populate officials & trades tables
  • Docker + deployment infrastructure
  • 93 passing tests with 88%+ coverage
  • Linting (ruff + mypy) all green
  • Works 100% offline with fixtures
  • Real-time market monitoring & alert system
  • Disclosure timing correlation engine
  • Pattern detection & comparative analysis
  • Automated email reporting (daily/weekly)
  • CI/CD pipeline (GitHub/Gitea Actions)

What You Can Do Now

Analyze Performance

# Analyze specific official
python scripts/analyze_official.py "Nancy Pelosi" --window 90

# System-wide analysis
python scripts/calculate_all_returns.py

Market Monitoring

# Run market scan
python scripts/monitor_market.py --scan

# Analyze timing of recent disclosures
python scripts/analyze_disclosure_timing.py --recent 7

# Generate pattern report
python scripts/generate_pattern_report.py --days 365

Automated Reporting

# Set up daily/weekly email reports (5 minutes!)
./scripts/setup_cron.sh

# Send manual report
python scripts/send_daily_report.py --to your@email.com

Add More Data

# Manual entry
python scripts/add_custom_trades.py

# CSV import
python scripts/scrape_alternative_sources.py import trades.csv

System Architecture

POTE now includes a complete 3-phase monitoring system:

Phase 1: Real-Time Market Monitoring

  • Tracks ~50 most-traded congressional stocks
  • Detects unusual volume, price spikes, volatility
  • Logs all alerts with timestamps and severity

Phase 2: Disclosure Correlation

  • Matches trades with prior market alerts (30-45 day lookback)
  • Calculates "timing advantage score" (0-100)
  • Identifies suspicious timing patterns

Phase 3: Pattern Detection

  • Ranks officials by consistent suspicious timing
  • Analyzes by ticker, sector, and political party
  • Generates comprehensive reports

Full Documentation: See MONITORING_SYSTEM_COMPLETE.md

Next Steps

  • Signals: "follow_research", "avoid_risk", "watch" with confidence scores
  • Clustering: group officials by trading behavior patterns
  • API: FastAPI backend for queries
  • Dashboard: React/Streamlit visualization

See docs/00_mvp.md for the full roadmap.


License: MIT (for research/educational use only)
Disclaimer: Not investment advice. Use public data only. No claims about inside information.

Description
No description provided
Readme 416 KiB
Languages
Python 91.2%
Shell 8.1%
Makefile 0.3%
Mako 0.2%
Dockerfile 0.2%