An intelligent portfolio monitoring and analysis system that aggregates data from 6+ financial APIs and uses Claude AI to generate actionable trading insights.
- Multi-Source Market Intelligence - Aggregates data from Alpha Vantage, Polygon, FMP, Finnhub, NewsAPI, and SEC API
- AI-Powered Analysis - Claude AI analyzes each position with comprehensive market data
- Market Regime Detection - Identifies market conditions (trend, volatility, breadth)
- Automated Morning Briefs - Comprehensive pre-market reports with actionable insights
- Real-time Monitoring - Continuous portfolio tracking via Alpaca API
- News Sentiment Analysis - Multi-source news aggregation with AI-powered sentiment scoring
- Insider Activity Tracking - Monitors SEC Form 4 filings for insider buy/sell signals
- Unusual Volume Scanner - Identifies high-probability setups based on volume anomalies
- Position Intelligence - Each position analyzed with fundamentals, technicals, news, and insider data
- Opportunity Scoring - Multi-factor ranking system for new trade setups
- Risk Management - Automated stop-loss and profit-taking recommendations
- Email alerts - Critical portfolio changes sent via Gmail
microcap_agent/
βββ api_clients.py                  # Multi-source data aggregation
βββ enhanced_report_generator.py    # AI-powered report generation
βββ run_enhanced_report.py          # Main execution script
βββ monitoring_agent.py             # Portfolio monitoring with alerts
βββ morning_brief.py                # Morning brief generation
βββ continuous_monitor.py           # Continuous monitoring service
βββ config.example.py               # API key template (SAFE TO COMMIT)
βββ config.py                       # Your actual API keys (NEVER COMMIT)
βββ test_*.py                       # API connection tests
βββ .gitignore                      # Protects sensitive data
βββ ENHANCED_REPORT_README.md       # Detailed documentation
βββ reports/                        # Generated reports (not committed)
cd microcap_agentpython -m venv venvActivate the virtual environment:
- Windows: venv\Scripts\activate
- macOS/Linux: source venv/bin/activate
pip install -r requirements.txtCopy the example environment file:
cp .env.example .envEdit .env and add your API keys:
ALPACA_API_KEY=your_alpaca_api_key_here
ALPACA_SECRET_KEY=your_alpaca_secret_key_here
ALPACA_BASE_URL=https://paper-api.alpaca.markets
ANTHROPIC_API_KEY=your_anthropic_api_key_hereAlpaca API:
- Sign up at Alpaca
- Navigate to Paper Trading dashboard
- Generate API keys from the dashboard
- Use https://paper-api.alpaca.marketsfor testing
Anthropic API:
- Sign up at Anthropic Console
- Generate an API key
- Copy the key to your .envfile
Generate AI-Powered Morning Brief
python run_enhanced_report.pyCreates comprehensive pre-market analysis with Claude AI, saved to reports/
Quick Market Check
python run_enhanced_report.py --quickFast market regime assessment (trend, volatility, breadth)
Test All Data Sources
python run_enhanced_report.py --testVerify all 6+ APIs are working correctly
Scheduled Execution
python run_enhanced_report.py --scheduleRuns automatically at 8:30 AM ET every weekday
Morning Brief
python monitoring_agent.py --morningContinuous Monitoring (every 5 min)
python monitoring_agent.py --monitorMarket Close Summary
python monitoring_agent.py --closeTest Individual APIs
python test_alpaca.py      # Trading platform
python test_anthropic.py   # Claude AI
python test_integration.py # Full integration- alpaca-trade-api - Alpaca trading API client
- anthropic - Anthropic Claude AI API client
- python-dotenv - Environment variable management
- google-auth - Google authentication (for Gmail)
- google-auth-oauthlib - OAuth support
- google-auth-httplib2 - HTTP transport for Google APIs
- google-api-python-client - Google API client library
Edit .env to customize behavior:
# Monitoring interval (minutes)
CHECK_INTERVAL_MINUTES=60
# Alert threshold (percentage change)
ALERT_THRESHOLD_PERCENT=5.0
# Google credentials file path
GOOGLE_CREDENTIALS_FILE=google_credentials.json- Never commit .envfile to version control
- Keep google_credentials.jsonprivate
- Use paper trading for testing
- Rotate API keys regularly
- NEVER commit config.py- Contains your actual API keys
- Verify .gitignore- Ensures sensitive files are excluded
- Use config.example.py- Template for other users
- Check before committing:
git status # Should NOT show config.py, logs/, or reports/
- config.py- Your API keys (CRITICAL)
- logs/- May contain sensitive portfolio data
- reports/- Contains your portfolio information
- credentials.json- Google OAuth tokens
- token.json- Access tokens
- Basic Alpaca integration
- Basic Claude integration
- Multi-source data aggregation (6+ APIs)
- AI-powered morning briefs
- Market regime detection
- News sentiment analysis
- Insider activity tracking
- Continuous monitoring loop
- Alert detection system
- Gmail notifications
- Options flow analysis
- Real-time WebSocket feeds
- Backtesting framework
- PDF reports with charts
- Dashboard interface
If you see "Configuration errors", ensure all required environment variables are set in .env:
- ALPACA_API_KEY
- ALPACA_SECRET_KEY
- ANTHROPIC_API_KEY
Alpaca:
- Verify API keys are correct
- Check if using correct base URL (paper vs live)
- Ensure account is active
Anthropic:
- Verify API key is valid
- Check account has available credits
This project is for educational and personal use.
For issues or questions, please refer to: