This app is a demo that demonstrates how to use Flask and SocketIO to capture real-time data from the stock and cryptocurrency market. Specifically, it captures the price of Bitcoin and plots it using Chart.js. Users can create alerts by setting price limits, pausing or resuming alert messages, and resetting price limits as needed. Thanks to Firebase Realtime Database, all changes in both prices and transaction volume are saved in real-time.
Before you can use the app, you'll need to complete the following pre-settings:
- Set up Firebase in app.py and enable real-time data storage by using the following code. Replace "yourprojectname-firebase-serviceaccountKey.json" with your actual service account file name. After registering on Firebase, download the service account file and rename it to match the filename in the code.
Optionally, if you also want to receive alert messages via phone, you can register your app on Twilio."
cred = credentials.Certificate("yourprojectname-firebase-serviceaccountKey.json")
- Rename copyenvfile to .env and save it in the root directory. Follow the instructions in the file.
Follow these steps to quickly get started with the app:
- Install virtualenv by running the following command in your terminal:
pip install virtualenv
- Create a virtual environment by running the following command in your terminal:
virtualenv venv
- Activate the virtual environment by running the following command in your terminal:
source venv/bin/activate
4.Install the required packages by running the following command in your terminal:
pip install -r requirements.txt
- Run the Flask application by running the following command in your terminal:
flask run
Note: Before running the flask run command, make sure you have navigated to the project directory where the app.py file is located. Also, ensure that the requirements.txt file is present in the same directory.