Skip to content

Bobagi/Coin-Alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coin-alert

Python bot to watch coin value changes.

Note:

  • You must define an Email and its App Password in the .env file, along with the DESTINY_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.

Install Python

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

Install pip

If pip is not already installed on your VPS, install it using:

sudo apt-get install python3-pip

Important

For services like Gmail, you need to create an App Password.

1. Creating and Activating the Virtual Environment

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

2. Installing Dependencies

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

3. Running the Application

The project has been split into two main components:

  1. API Endpoints (located in app.py):
    This file contains the Flask API endpoints (e.g., /test, /registerAlert, etc.).

  2. Email Monitoring (located in scripts/send_email.py):
    This script handles the periodic checking of coin values and sends emails accordingly.

To run the API:

python app.py

To run the Email Monitoring script:

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.

Additional Information

  • 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 and init.sql if needed.

About

Python bot to watch coin value changes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages