Skip to content

abdkhan-git/StockInsightsTracker

Repository files navigation

House Member Trades Notifier

This project monitors financial disclosures for U.S. House members, tracks stock trades, and provides notifications with detailed trade information. It can analyze PDF disclosures using AI-powered content extraction.

Table of Contents

Description

This Python application monitors financial disclosures for U.S. House members, tracks stock trades, and provides notifications with detailed trade information. It can analyze PDF disclosures using AI-powered content extraction to provide comprehensive trade details.

Preview

image image

Video Demo

Short Video Demo

Features

  • Automated Disclosure Monitoring: Downloads and processes financial disclosure data from the House Clerk's website
  • Targeted Member Tracking: Monitors specific House members (configurable via environment variables)
  • Trade Analysis: Extracts and formats stock trade information from PDF disclosures
  • Email Notifications: Sends detailed email notifications for new trades
  • AI-Powered PDF Analysis: Uses OpenRouter API to extract and format trade information from PDF documents
  • Persistent Tracking: Maintains a record of processed trades to avoid duplicate notifications

Prerequisites

  • Python 3.x
  • Required Python packages listed in requirements.txt

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/house-member-trades-notifier.git
    cd house-member-trades-notifier
  2. Create a virtual environment (recommended):

    python -m venv .venv
    source .venv/bin/activate  # On Windows use `.venv\Scripts\activate`
  3. Install the required Python packages:

    pip install -r requirements.txt

Configuration

  1. Create a .env file in the project directory with the following variables:

    # Email Configuration
    SENDER_EMAIL=your_email@example.com
    SENDER_NAME=Your Name
    APP_PASSWORD=your_app_password
    RECIPIENT_EMAIL=recipient1@example.com,recipient2@example.com
    EMAIL_SERVER=smtp.example.com
    EMAIL_PORT=465
    
    # Monitoring Configuration
    TARGET_MEMBERS=Pelosi,McCarthy,Schumer
    TIMEFRAME_DAYS=60
    
    # AI Configuration
    OPENROUTER_API_KEY=your_openrouter_api_key
    AI_MODEL=mistralai/mistral-small-3.2-24b-instruct:free
    PDF_EXRACTOR=True
    
    # Storage Configuration
    PROCESSED_TRADES_FILE=processed_trades.txt
  2. Ensure your .gitignore file includes the .env file to avoid pushing sensitive information to GitHub:

    .env
    .venv/
    __pycache__/
    *.pyc
  3. For Docker deployment, create a .env file with the same variables and mount it as a volume.

Usage

  1. Run the script:

    python nancy.py
  2. The script will:

    • Continuously check for new financial disclosures
    • Monitor trades for the specified House members
    • Extract trade information from PDF documents
    • Send email notifications for new trades
  3. To stop the script, use Ctrl+C in the terminal.

Docker Deployment (Optional)

  1. Build the Docker image:

    docker build -t house-member-trades-notifier .
  2. Run the container:

    docker run -d --name trades-notifier \
      -v $(pwd)/.env:/app/.env \
      -v $(pwd)/processed_trades.txt:/app/processed_trades.txt \
      house-member-trades-notifier

Development

  1. Install development dependencies:

    pip install -r requirements-dev.txt
  2. Run tests:

    pytest
  3. Run with debug logging:

    python -m debug nancy.py

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Get Alerts on Nancy Pelosi's Stock Trades!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 3

  •  
  •  
  •