Python bot to watch coin value changes.
Note:
- You must define an Email and its App Password in the
.env
file, along with theDESTINY_EMAIL
variable which is the email that will receive the alert messages. - This project was a test to implement the Coin Alert as seen on: https://bobagi.click/CoinAlert.
If Python is not already installed on your VPS, you will need to install it. For example, on Ubuntu:
sudo apt-get update
sudo apt-get install python3
If pip is not already installed on your VPS, install it using:
sudo apt-get install python3-pip
For services like Gmail, you need to create an App Password.
Open your terminal and run:
python -m venv venv # Creates the virtual environment
To activate the virtual environment:
-
Linux/Mac:
source venv/bin/activate
-
Windows:
source venv/Scripts/activate
or
.\venv\Scripts\Activate
To deactivate the environment, simply run:
deactivate
First, upgrade pip:
python -m pip install --upgrade --force-reinstall pip
Then install the required packages with:
pip install -r requirements.txt
If you need to update your requirements.txt
file, run:
pip freeze > requirements.txt
Dependencies:
- python-dotenv
- requests
- secure-smtplib (if applicable)
- Flask
- psycopg2-binary
- colorama
The project has been split into two main components:
-
API Endpoints (located in
app.py
):
This file contains the Flask API endpoints (e.g.,/test
,/registerAlert
, etc.). -
Email Monitoring (located in
scripts/send_email.py
):
This script handles the periodic checking of coin values and sends emails accordingly.
python app.py
python scripts/send_email.py
Note: In production, you might run the API with a WSGI server (like Gunicorn) instead of using Flask's development server.
-
Email Alerts:
The email monitoring script periodically (every 10 minutes) checks coin values and sends alerts based on threshold conditions stored in your PostgreSQL database. -
Database Setup:
Ensure that you have a PostgreSQL database running with the required tables. Use the provided Docker Compose file andinit.sql
if needed.