This is a Django application that allows users to set price alerts for various cryptocurrencies. When the target price for a cryptocurrency is reached or exceeded, the application sends an email notification to the user.
- User authentication
- Create, view, and delete price alerts
- Email notifications when the target price is reached
- Caching for alert listings
- Python 3.x
- Django 3.x or higher
- Celery
- Redis (for Celery broker)
- An email service (configured in Django settings)
-
Clone the repository:
git clone https://github.com/ketanspage/crypto-price-alert.git cd crypto-price-alert
-
Install the dependencies:
pip install -r requirements.txt
-
Set up your Django settings:
- Configure your database in
settings.py
- Configure your email backend in
settings.py
- Add your Celery configuration in
settings.py
- Configure your database in
-
Run the migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Build and start the services with Docker Compose:
docker compose --build docker compose up
-
Create a new alert:
POST /alerts/
Request body:
{ "cryptocurrency": "btc", "target_price": 30000.00 }
Headers:
Authorization: Token your-auth-token
-
List all alerts for the authenticated user:
GET /alerts/
Headers:
Authorization: Token your-auth-token
-
Filter alerts by status:
GET /alerts/?status=created
Headers:
Authorization: Token your-auth-token
-
Delete an alert:
DELETE /alerts/{alert_id}/delete_alert/
Headers:
Authorization: Token your-auth-token
-
Get token:
POST /api/token/
Headers:
Username: your_created_username Password: your_created_password
The Celery task check_cryptocurrency_prices
periodically fetches the latest prices of cryptocurrencies and checks them against the created alerts. If the target price is met or exceeded, it sends an email notification to the user and updates the alert status.
This project is licensed under the MIT License - see the LICENSE file for details.
For any issues or questions, please contact gandhi.ketan55555@gmail.com.