Welcome to the IPO Alert Automation Project! This project is designed to fetch the latest IPO details from Sharesansar, process the data, and send notifications to specified email addresses. It's an efficient and automated solution to keep track of IPOs effortlessly.
- Automated Web Scraping: Fetches IPO data directly from Sharesansar
- Smart Email Notifications: Sends detailed IPO alerts to multiple recipients
- Duplicate Prevention: Tracks already-notified IPOs to avoid redundancy
- Robust Error Handling: Comprehensive error handling and logging
- Health Monitoring: Built-in health checks and system monitoring
- Command Line Interface: Easy-to-use CLI with multiple commands
- Modular Design: Clean, maintainable, and extensible codebase
- Comprehensive Testing: Unit tests for critical components
- Retry Logic: Automatic retry for network operations
This project is specifically designed for IPOs in Nepal, targeted towards Nepali citizens. It only supports IPO notifications and does not include information about FPOs (Follow-on Public Offers) or Right Shares.
- Python 3.8 or higher
- Gmail account with 2-factor authentication enabled
- Gmail App Password (not your regular password)
git clone https://github.com/SLASH217/IPO-Alert.git
cd IPO-Alert
python setup.pyThe setup script will:
- Check Python version compatibility
- Install all dependencies
- Create necessary directories
- Help you configure environment variables
- Run health checks
If you prefer manual setup:
# Install dependencies
pip install -r requirements.txt
# Copy environment template
cp .env.example .env
# Edit .env with your configuration
nano .envEdit .env file with your details:
EMAIL_ADDRESS=your_email@gmail.com
APP_PASSWORD=your_app_password
RECIPIENT_EMAIL_LIST=recipient1@email.com,recipient2@email.comImportant: For Gmail, you need an App Password, not your regular password:
- Enable 2-factor authentication on your Google account
- Generate an App Password at: https://myaccount.google.com/apppasswords
- Use this App Password in the configuration
IPO-Alert/
โโโ src/ # Source code
โ โโโ __init__.py
โ โโโ config.py # Configuration management
โ โโโ database.py # Data storage and management
โ โโโ email_service.py # Email functionality
โ โโโ logger.py # Logging configuration
โ โโโ main_app.py # Main application logic
โ โโโ models.py # Data models
โ โโโ scraper.py # Web scraping logic
โโโ tests/ # Unit tests
โ โโโ test_config.py
โ โโโ test_models.py
โ โโโ ...
โโโ data/ # Data storage
โโโ logs/ # Application logs
โโโ .github/ # GitHub Actions workflows
โ โโโ workflows/
โ โโโ ci.yml
โ โโโ cloud-automation.yml
โโโ scripts/ # Automation scripts
โ โโโ health_check.sh
โ โโโ setup_env.sh
โโโ main.py # Main entry point
โโโ cli.py # Command line interface
โโโ setup.py # Setup script
โโโ .env.example # Environment template
โโโ requirements.txt # Dependencies
# Run IPO alert process
python main.py
# Or using CLI
python cli.py run# Run with options
python cli.py run --dry-run # Test without sending emails
python cli.py run --force # Force send even if already notified
# System monitoring
python cli.py health # Check system health
python cli.py stats # Show statistics
# Maintenance
python cli.py cleanup # Clean old records (30 days)
python cli.py cleanup --days 60 # Clean records older than 60 days
# Help
python cli.py --help # Show all commandsPerfect for 24/7 operation even when your laptop is off!
๐ Complete GitHub Actions Setup Guide
Quick setup:
- Push code to GitHub
- Add 3 secrets in GitHub repo settings
- Enable GitHub Actions
- Runs automatically at 9 AM & 4 PM IST daily
For running on your local machine only when it's on:
-
Make scripts executable:
chmod +x setup_automation.sh chmod +x scripts/health_check.sh
-
Run the automation setup:
./setup_automation.sh
-
Verify automation:
# Check if timer is active sudo systemctl status ipo-alert.timer # Check upcoming runs sudo systemctl list-timers ipo-alert.timer
# Test the health check
./scripts/health_check.sh
# Run a manual check
python main.py
# Check system stats
python -c "from src.database import DatabaseManager; db = DatabaseManager(); print(db.get_stats())"| Environment Variable | Required | Description | Default |
|---|---|---|---|
EMAIL_ADDRESS |
Yes | Your Gmail address | - |
APP_PASSWORD |
Yes | Gmail App Password | - |
RECIPIENT_EMAIL_LIST |
Yes | Comma-separated recipient emails | - |
SOURCE_URL |
No | IPO data source URL | https://www.sharesansar.com |
DATA_PATH |
No | Path to save HTML data | data/share.html |
NOTIFIED_IPOS_FILE |
No | Path to notification database | data/ipo_history.json |
LOG_LEVEL |
No | Logging level | INFO |
The system includes comprehensive health checks:
python cli.py healthChecks include:
- โ Configuration validation
- โ Email connection test
- โ Source website accessibility
- โ Database accessibility
Logs are stored in logs/ipo_alert.log with rotation:
- Maximum file size: 1MB
- Backup files: 5
- Format: Timestamp, level, function, line number, message
View application statistics:
python cli.py statsShows:
- Total notifications sent
- First/last notification dates
- Database size
- Configuration summary
Run the test suite:
# Install test dependencies
pip install pytest pytest-cov
# Run tests
pytest tests/
# Run with coverage
pytest tests/ --cov=src --cov-report=html- Environment Variables: Sensitive data stored securely
- App Passwords: Uses Gmail App Passwords instead of account passwords
- Input Validation: Comprehensive validation of all inputs
- Error Handling: No sensitive information in error messages
-
Email Authentication Failed
- Ensure 2-factor authentication is enabled
- Use App Password, not account password
- Check email address is correct
-
No IPOs Found
- Check internet connection
- Verify source website is accessible
- Check logs for detailed error information
-
Import Errors
- Ensure all dependencies are installed:
pip install -r requirements.txt - Check Python version (3.8+ required)
- Ensure all dependencies are installed:
-
Permission Errors
- Ensure write permissions for
data/andlogs/directories - Run with appropriate user permissions
- Ensure write permissions for
- Check logs in
logs/ipo_alert.log - Run health check:
python cli.py health - Test configuration:
python cli.py run --dry-run - Open an issue on GitHub with log details
- Web Dashboard: Web interface for monitoring and configuration
- SMS Notifications: Add SMS alert support
- Multiple Sources: Support for additional IPO data sources
- Scheduling: Built-in scheduler for automated runs
- Docker Support: Containerized deployment
- API Integration: REST API for external integrations
- Mobile App: Mobile application for notifications
Contributions are welcome! Please feel free to submit a Pull Request.
git clone https://github.com/SLASH217/IPO-Alert.git
cd IPO-Alert
python setup.py
pip install pytest black flake8- Use Black for code formatting:
black src/ - Follow PEP 8 guidelines
- Add type hints where appropriate
- Write tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Author: Prashanna Dahal
- Email: prashanna217@gmail.com
- GitHub: SLASH217
- Sharesansar for providing IPO data
- Python community for excellent libraries
- Contributors and users for feedback and suggestions
โญ If you find this project helpful, please consider giving it a star on GitHub! Price per Unit: NPR 100 Start Date: 2025-01-15 End Date: 2025-01-25
Visit the official site to apply now: https://meroshare.cdsc.com.np
Best regards, IPO Tracker Team
---
## Future Enhancements
- Add support for additional data sources.
- Integrate a dashboard to view and manage IPO alerts.
- Add SMS notification support.
- Enhance error logging and monitoring.
---
## License
This project is licensed under the MIT License.
---
## Contributions
Contributions, issues, and feature requests are welcome! Feel free to fork this repository and submit a pull request.
---
## Contact
For any queries, reach out to:
- **Author**: Prashanna Dahal
- **Email**: prashanna217@gmail.com
- **GitHub**: [SLASH217](https://github.com/SLASH217)