Aniket-Dev-IT/Price-Monitor-System
๐ท๏ธ Price Monitoring & Analytics Platform - Intelligent e-commerce price tracking with AI-powered insights, real-time alerts, and comprehensive reporting for businesses and developers
๐ Professional Price Monitoring System
A comprehensive, production-ready price monitoring system that tracks product prices across multiple e-commerce platforms with automated alerts, historical analysis, and beautiful visualizations.
๐ Features
Core Functionality
- ๐ Multi-Platform Support: Amazon, Flipkart, and generic e-commerce sites
- ๐ Real-Time Monitoring: Automated price checking with smart scheduling
- ๐ฏ Target Price Alerts: Get notified when products reach your desired price
- ๐ Historical Analysis: Track price trends over time with detailed charts
- ๐พ Database Storage: SQLite for local use, PostgreSQL for production
Advanced Features
- ๐ Smart Scraping: User agent rotation and anti-detection mechanisms
- ๐ง Email Notifications: Professional email alerts for price changes
- ๐ฑ REST API: FastAPI-powered API for integration with other applications
- ๐ Data Visualization: Beautiful charts with matplotlib and seaborn
- ๐ Export Options: CSV and Excel reports for external analysis
Professional Grade
- โก Performance Optimized: Efficient database queries and caching
- ๐ก๏ธ Error Handling: Comprehensive logging and graceful failure recovery
- ๐ง Highly Configurable: Customizable scraping rules and alert conditions
- ๐ Scalable Architecture: Handle thousands of products efficiently
๐ Quick Start
Prerequisites
- Python 3.8 or higher
- pip package manager
Installation
-
Clone the repository:
git clone https://github.com/DevAniketIT/Price-Monitor-System.git cd price-monitor-system -
Install dependencies:
pip install -r requirements.txt
-
Run the demo:
python price_monitor_system.py
Basic Usage
from price_monitor_system import PriceMonitor
# Initialize the monitor
monitor = PriceMonitor()
# Add a product to monitor
product_id = monitor.add_product(
name="iPhone 15 Pro",
url="https://amazon.com/dp/B0CHX9CY7W",
target_price=999.00
)
# Check prices manually
monitor.check_single_product(product_id)
# Or check all products
monitor.check_all_products()
# Generate reports
report = monitor.get_summary_report()
chart_file = monitor.generate_price_chart(product_id)๐ Documentation
System Architecture
The system consists of several key components:
- PriceMonitor: Core monitoring class with scraping logic
- Database Layer: SQLite/PostgreSQL for data persistence
- EmailNotifier: Automated email alert system
- API Layer: FastAPI REST endpoints for external integration
- Visualization: Chart generation and data export utilities
Supported E-commerce Platforms
| Platform | Status | Features |
|---|---|---|
| Amazon | โ Full Support | Price, availability, product name |
| Flipkart | โ Full Support | Price, availability, product name |
| Generic Sites | โ Basic Support | Pattern-based price extraction |
Database Schema
Products Table
CREATE TABLE products (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
url TEXT UNIQUE NOT NULL,
target_price REAL,
current_price REAL,
last_checked TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
active BOOLEAN DEFAULT 1
);Price History Table
CREATE TABLE price_history (
id INTEGER PRIMARY KEY,
product_id INTEGER,
price REAL NOT NULL,
availability BOOLEAN,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (product_id) REFERENCES products (id)
);๐ง API Usage
Start the FastAPI server:
python price_monitor_api.pyKey Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET |
/products |
List all monitored products |
POST |
/products |
Add new product to monitor |
GET |
/products/{id} |
Get specific product details |
PUT |
/products/{id} |
Update product settings |
DELETE |
/products/{id} |
Remove product from monitoring |
POST |
/check-prices |
Trigger price check |
GET |
/products/{id}/history |
Get price history |
GET |
/alerts |
Get recent alerts |
Example API Usage
import requests
# Add a product via API
response = requests.post("http://localhost:8000/products", json={
"name": "MacBook Pro 16\"",
"url": "https://amazon.com/dp/B09JQKBQSB",
"target_price": 2299.00
})
product = response.json()
# Get price history
history = requests.get(f"http://localhost:8000/products/{product['id']}/history")๐ Data Export & Visualization
Generate Reports
# Excel report with multiple sheets
excel_file = monitor.generate_excel_report()
# CSV export
csv_files = monitor.export_to_csv(export_type="all")
# Price charts
chart_file = monitor.generate_price_chart(product_id, days=30)Sample Visualizations
The system generates professional charts showing:
- Price trends over time
- Minimum, maximum, and current prices
- Target price indicators
- Availability status
๐ Email Notifications
Set up email alerts for price changes:
from price_monitor_system import EmailNotifier
# Configure email
notifier = EmailNotifier()
notifier.setup_email(
email="your-email@gmail.com",
password="your-app-password", # Use Gmail App Password
recipients=["alert@yourdomain.com"]
)
# Automatic alerts are sent when:
# - Price drops by 5% or more
# - Target price is reached
# - Product comes back in stockโ๏ธ Configuration
Environment Variables
# Optional: PostgreSQL connection
DATABASE_URL=postgresql://user:password@localhost/pricedb
# Email configuration
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587Customization Options
- Scraping Intervals: Modify
setup_scheduler()function - Alert Thresholds: Adjust percentage triggers in
check_single_product() - User Agent Rotation: Add more user agents in
__init__() - Site Support: Extend scraping methods for new e-commerce sites
๐ Performance & Scalability
Optimization Features
- Connection Pooling: Reuse HTTP connections for better performance
- Rate Limiting: Respectful delays to avoid being blocked
- Database Indexing: Optimized queries for large datasets
- Async Support: FastAPI endpoints for concurrent operations
Recommended Limits
- SQLite: Up to 1,000 products for personal use
- PostgreSQL: Unlimited products for enterprise use
- Scraping Frequency: Maximum once per hour per product
- Concurrent Checks: 5-10 products simultaneously
๐ผ Business Applications
Freelance Opportunities
- Custom Price Monitoring: $200-500 per project
- E-commerce Integration: $500-1000 per implementation
- Data Analysis Services: $30-80 per hour
- Recurring Monitoring: $50-150 monthly per client
Enterprise Features
- White-label solutions for retailers
- API integration for inventory management
- Custom alert systems for procurement teams
- Competitive pricing intelligence
๐งช Testing
Run the test suite:
# Basic functionality test
python -m pytest tests/
# Run demo with sample data
python price_monitor_system.pyTest Coverage
- โ Database operations
- โ Web scraping functionality
- โ Price change detection
- โ Alert generation
- โ API endpoints
- โ Export functionality
๐ Security & Ethics
Responsible Scraping
- Respectful request rates (2-5 second delays)
- User agent rotation to minimize server load
- Error handling to avoid infinite retry loops
- Compliance with robots.txt when applicable
Data Privacy
- Local database storage by default
- No data collection or external transmission
- Secure email credential handling
- Optional encryption for sensitive data
๐ Deployment Options
Local Development
python price_monitor_system.pyProduction Deployment
# Using Gunicorn for API
gunicorn price_monitor_api:app -w 4 -k uvicorn.workers.UvicornWorker
# With Docker
docker build -t price-monitor .
docker run -p 8000:8000 price-monitorCloud Deployment
- Heroku: Deploy with PostgreSQL addon
- DigitalOcean: Use App Platform for easy scaling
- AWS: Lambda functions for serverless monitoring
- Railway: Simple deployment with managed databases
๐ Project Structure
price-monitor-system/
โโโ price_monitor_system.py # Core monitoring system
โโโ price_monitor_api.py # FastAPI REST API
โโโ requirements.txt # Python dependencies
โโโ README.md # This documentation
โโโ tests/ # Test files
โโโ examples/ # Usage examples
โโโ docs/ # Additional documentation
โโโ scripts/ # Utility scripts
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Follow PEP 8 style guidelines
- Add tests for new features
- Update documentation for API changes
- Use meaningful commit messages
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- BeautifulSoup: For HTML parsing capabilities
- Requests: For reliable HTTP requests
- FastAPI: For modern API development
- Matplotlib: For beautiful data visualizations
- SQLite/PostgreSQL: For robust data storage
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Developer: Aniket Kumar (DevAniketIT)
- Email: aniket.kumar.devpro@gmail.com
๐ฏ Roadmap
Version 2.0 Planned Features
- Machine learning price prediction
- Mobile app companion
- Webhook integrations
- Advanced analytics dashboard
- Multi-language support
- Cryptocurrency price tracking
Built with โค๏ธ by Aniket Kumar - Turning ideas into scalable solutions
Developer: Aniket Kumar (DevAniketIT) - A passionate Python developer specializing in automation, web scraping, and enterprise solutions.
This project demonstrates professional Python development practices and showcases advanced skills in system architecture, API development, and business automation.