A comprehensive Django-based stock price prediction application with machine learning capabilities, REST API, web dashboard, and Telegram bot integration.
- 📊 Dashboard: https://predict.jitendraky.tech/dashboard
- 🤖 Telegram Bot: https://t.me/unintern89bot
- 🤖 Machine Learning Predictions: Advanced TensorFlow/Keras models for stock price forecasting
- 📊 Web Dashboard: Interactive web interface for making predictions and viewing results
- 🚀 REST API: RESTful API with JWT authentication
- 🤖 Telegram Bot: Get predictions directly via Telegram
- 📈 Historical Data: Fetch and analyze historical stock data using Yahoo Finance
- 🔒 Rate Limiting: Built-in rate limiting to prevent abuse
- 📱 Responsive Design: Modern, mobile-friendly web interface
- 🔄 Async Processing: Celery task queue for handling predictions
- 🐳 Docker Support: Containerized deployment with Docker Compose
- 📊 Visualization: Interactive charts and graphs for predictions
- 🧪 automated testing: automated test using github actions.
- Backend: Django 5.0.6, Django REST Framework
- Machine Learning: TensorFlow 2.19.0, Scikit-learn
- Database: SQLite (default), PostgreSQL, MySQL, MSSQL support
- Cache/Queue: Redis, Celery
- Data Source: Yahoo Finance API (yfinance)
- Visualization: Matplotlib
- Telegram: python-telegram-bot
- Deployment: Docker, Gunicorn, Nginx-ready
- Python 3.8+
- Redis server
- Git
-
Clone the repository
git clone https://github.com/jitendra-ky/price_predictor cd price_predictor -
Create environment file
cp .env.example .env
Edit
.envwith your configuration: -
Build and run with Docker
docker-compose up --build
-
Access the application
- Web Dashboard: http://localhost:8000/dashboard/
-
Clone and setup virtual environment
git clone https://github.com/jitendra-ky/price_predictor cd price_predictor python -m venv .venv source .venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Setup Redis
# Ubuntu/Debian sudo apt-get install redis-server sudo systemctl start redis-server # macOS brew install redis brew services start redis # Windows # Download and install Redis from https://redis.io/download
-
Environment setup
cp .env.example .env # Edit .env with your configuration -
Database setup
python manage.py makemigrations python manage.py migrate python manage.py createsuperuser
-
Start services
Terminal 1 - Django Server:
python manage.py runserver
Terminal 2 - Celery Worker: (only needed for telegram bot)
python manage.py startcelery
Terminal 3 - Telegram Bot:
python manage.py telegrambot
Create a .env file in the root directory:
check .env.example
- Navigate to
http://localhost:8000/dashboard - Register a new account or login
- Enter a stock ticker symbol (e.g., AAPL, GOOGL, TSLA)
- Click "Predict" to get ML-powered predictions
- View interactive charts and metrics
- Start a chat with your bot
- Use
/startto begin - Use
/predict AAPLto get predictions for Apple stock - Use
/helpfor all available commands - use
/latestto get recent prediction
price_predictor/
├── core/ # Main application
│ ├── management/commands/ # Django management commands
│ ├── services/ # Business logic
│ ├── telegram/ # Telegram bot integration
│ └── utils/ # Utility functions
├── user/ # User management
├── templates/ # HTML templates
├── static/ # Static files
├── media/ # User uploads
├── zproject/ # Django settings
└── requirements.txt # Python dependencies
python manage.py test# Run linting
ruff check .
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/v1/register/ |
Register new user | No |
| GET | /api/v1/register/ |
Get user profile | Yes |
| POST | /api/v1/token/ |
Get JWT token | No |
| POST | /api/v1/token/refresh/ |
Refresh JWT token | No |
| POST | /api/v1/predict/ |
Make stock prediction | Yes |
| GET | /api/v1/predictions/ |
Get user predictions | Yes |
| GET | /healthz/ |
Health check | No |