An automated trading system that integrates with Charles Schwab's API to automate watchlist scanners and execute trades automatically.
This Portfolio Manager application connects to your Charles Schwab account to:
- Monitor and scan watchlists
- Analyze market data and stock screening criteria
- Automatically execute trades based on your predefined strategies
- Track open positions and portfolio performance
- Send email notifications for important events
- Automated Watchlist Scanning: Continuously monitor stocks in your watchlists
- Smart Screener: Filter and identify trading opportunities based on technical indicators
- Trade Automation: Execute buy/sell orders automatically based on your criteria
- Position Tracking: Monitor open positions and portfolio status
- Email Integration: Receive notifications and updates via email
- Portfolio Display: Web-based interface to view your portfolio status
- Python 3.8 or higher
- Charles Schwab brokerage account
- Charles Schwab API credentials (App Key and Secret)
- Email account for notifications (Gmail recommended)
- Clone this repository:
git clone https://github.com/J0shusmc/portfolio-manager.git
cd portfolio-manager- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install required packages:
pip install -r requirements.txt- Set up your credentials:
cp env.example.py env.py
# Edit env.py with your actual credentials- Visit Charles Schwab Developer Portal
- Create a new application to get your App Key and App Secret
- Add your credentials to
env.py:app_key: Your Charles Schwab App Keyapp_secret: Your Charles Schwab App Secretcallback_url: Redirect URL (default: https://127.0.0.1)account_nbr: Your Schwab account number
Configure email credentials in env.py for notifications:
mail_username: Your email addressmail_password: App password (for Gmail: create here)
./run_with_dns.shpython main.py- Mail Reader:
python mailreader.py- Read portfolio emails - Screener:
python screener.py- Run stock screener - Portfolio Display:
python portfolio_display.py- Launch web interface
portfolio-manager/
├── main.py # Main application entry point
├── mailreader.py # Email integration for portfolio updates
├── screener.py # Stock screening and analysis
├── portfolio_display.py # Web interface for portfolio viewing
├── openpositions.txt # Current open positions tracker
├── watchlist.txt # Stocks to monitor
├── scanner.txt # Scanner results and alerts
├── env.example.py # Configuration template
├── requirements.txt # Python dependencies
├── run_with_dns.sh # DNS-aware startup script
└── docs/ # Additional documentation
└── WORKFLOW.md # Development workflow guide
- openpositions.txt: Tracks your current open positions
- watchlist.txt: Maintains list of stocks to monitor
- scanner.txt: Stores screening results and trade signals
- Never commit
env.pyto version control - Keep your API credentials secure
- The
.gitignorefile is configured to exclude sensitive files - Use App Passwords for email accounts, not your main password
Key packages used:
schwab-py: Charles Schwab API Python clientschwabdev: Charles Schwab development toolsyfinance: Yahoo Finance market datapandas: Data analysis and manipulationimap-tools: Email reading capabilitiesFlask: Web interface framework
See requirements.txt for complete list.
- Always test thoroughly in a paper trading environment first
- Monitor your automated trades regularly
- Understand the strategies and logic before enabling automation
- The authors are not responsible for any financial losses
- Trading stocks involves risk of loss
Contributions are welcome! Please feel free to submit issues or pull requests.
This project is provided as-is for educational and personal use.
For questions or issues:
- Open an issue on GitHub
- Review the documentation in
/docs
Note: This application is designed for personal use with Charles Schwab accounts. Ensure you comply with all applicable trading regulations and Charles Schwab's API terms of service.