This is a Price Alert System to monitor the price of Solana (SOL) and send real-time alerts when the prices cross set thresholds. The system helps users make timely trading decisions by notifying them via email when the price reaches their target values. Users can customize alerts for price movements in both upward and downward directions.
- User authentication using email login
- User can add different price range to monitor price movements either up or down
- user can delete price
- Python
- Django
- Postgresql
- Celery
- Redis (for Celery broker)
To get a local copy up and running follow these simple steps.
- install python3.10 or above
- install postgresql
- Install Docker (optional, if you prefer using Docker for setup).
- Clone your project locally:
git clone https://github.com/debugtitan/Crypto-Price-Alert-System.git
cd Crypto-Price-Alert-System
-
Create a .env file and use the .env.example as a template to set up your environment variables.
-
Run the following command to start the services
- Run docker compose up
-
-
Create and activate your virtual environment
-
Install project dependencies::
# With python pip install requirements.txt
-
Apply migrations:
python3 manage.py migrate
-
Start the development server
python3 manage.py runserver
-
The AuthViewSet
class provides endpoints for user authentication using email login.
https://price-watcher.debugtitan.com/api/v1
POST /auth/initialize_email_login/
Sends a login code to the user's email address.
Headers:
Content-Type: application/json
Body:
{
"email": "[email protected]"
}
Response
Status: 200 OK
Body:
{
"message": "A login code has been sent to [email protected]"
}
POST /auth/finalize_email_login
Login a user.
Headers:
Content-Type: application/json
Body:
{
"email": "[email protected]",
"token": "190651"
}
Response
Status: 200 OK
Body:
{
"id": 1,
"email": "[email protected]",
"token": {
"refresh": "refresh_token",
"access": "access_token"
}
}
Endpoint: GET /alerts/
Description:
Retrieve all alerts created by the authenticated user.
Request:
Headers:
Authorization: Bearer <your_token>
Response:
Status Code: 200 OK
Body:
[
{
"id": 1,
"target_price": 5000,
"owner": 1
},
{
"id": 2,
"target_price": 10000,
"owner": 1
}
]
Endpoint: POST /alerts/
Description:
Create a new price alert for the authenticated user. This alert requires both a target price and a direction to trigger notifications.
Request:
Headers:
Content-Type: application/json
Authorization: Bearer <your_token>
Body:
{
"target_price": 7500,
"direction": "HIGH"
}
- target_price (required): The price at which the alert should trigger.
- direction (optional): The direction for the alert. Can be "HIGH" or "LOW". default is "HIGH"
Response:
Status Code: 201 Created
Body:
{
"id": 3,
"target_price": 7500,
"direction": "above",
"owner": 1
}
Endpoint: DELETE /alerts/{id}/
Description:
Delete an existing alert created by the authenticated user.
Request:
Headers:
Authorization: Bearer <your_token>
Path Parameters:
id
(required): The ID of the alert to be deleted.
Response:
Status Code: 204 No Content
Description:
The alert was successfully deleted.
Errors:
Status Code: 404 Not Found
Body:
{
"detail": "Not found."
}