Skip to content

Price Alert System for Solana Tokens monitors token prices and sends real-time alerts when they cross set thresholds, helping users make timely trading decisions.

License

Notifications You must be signed in to change notification settings

debugtitan/Crypto-Price-Alert-System

Repository files navigation

Table Of Contents

About The Project

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.

Features

  • User authentication using email login
  • User can add different price range to monitor price movements either up or down
  • user can delete price

Built With

  • Python
  • Django
  • Postgresql
  • Celery
  • Redis (for Celery broker)

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • install python3.10 or above
  • install postgresql
  • Install Docker (optional, if you prefer using Docker for setup).

Installation

  • 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.

  • Using Docker

    Run the following command to start the services

    • Run docker compose up
  • Manually

    • 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

DOcumentation

AuthViewSet

The AuthViewSet class provides endpoints for user authentication using email login.

BASE URL

https://price-watcher.debugtitan.com/api/v1

Initialize Email Login

POST /auth/initialize_email_login/

Description

Sends a login code to the user's email address.

Request

Headers:

  • Content-Type: application/json

Body:

{
  "email": "[email protected]"
}

Response

Status: 200 OK

Body:

{
  "message": "A login code has been sent to [email protected]"
}

Finalize Email Login

POST /auth/finalize_email_login

Description

Login a user.

Request

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"
  }
}

Alert Management

List Alerts

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
  }
]

Create Alert

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"
}

Fields:

  • 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
}

Delete Alert

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."
}

About

Price Alert System for Solana Tokens monitors token prices and sends real-time alerts when they cross set thresholds, helping users make timely trading decisions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published