As an avid investor, I found myself constantly checking stock prices, hoping to catch the perfect trading opportunities. One day, while monitoring the market on my smartphone, I missed a crucial price change. Frustrated by this setback, I realized the need for a real-time stock alert system that would notify me whenever a stock reached a specific threshold. Motivated by this experience, I embarked on a journey to create a Stock Alert system using Bolt IoT.
Below is the video of project in action:
Hardware setupStep 1: Gathering all the required components
All the components required for the project are already available in BOLT IoT starter kit.
Step 2: Assembling the hardware
- Insert both the legs of buzzer in 2 different holes of breadboard.
- Connect the breadboard and wifi module through Assorted Connecting Wires.
- Put the wire of longer leg of buzzer into GPIO pin labeled as 1 and wire of shorter leg of the buzzer into GND pin.
- Finally connect the setup to laptop’s USB port or power adapter
Step 1: Platform details
Bolt IoT platform gives you the capability to control your devices and collect data from IoT devices safely and securely no matter where you are. Get actionable insights by deploying machine learning algorithms with just a few clicks to detect anomalies as well as predict sensor values.
Step 2: Connecting Bolt to cloud
After assembling the hardware, register and connect the Bolt unit to the Bolt Cloud.Go to Products -> Add Product -> Create New Product -> Change then icon -> Write Product Name -> Select Output Device and UART radio buttons -> Click on Done -> Click on Chain like icon and select your bolt iot device -> Done
Step 3: Get the code.
Get the code from the GitHub repository of this project. Download a.zip file or clone it to your system, whatever suits you.
Step 4: Working with the code.
There are two files:
- app.py: Creates a web application that allows users to enter a stock symbol and a threshold price. It then continuously checks the stock price using the Alpha Vantage API and triggers notifications (SMS, email, and Telegram) when the stock price reaches or exceeds the specified threshold. It also activates a buzzer connected to the Bolt device for a brief period when the threshold is reached.Note: Replace all the credentials.
- index.html: Creates a simple form where users can enter a stock symbol and a threshold price. When the form is submitted, it sends the data to the Flask application for further processing.
Step 5: Executing the Files
- Open a terminal or command prompt and navigate to the directory where you saved the project files.
- Run the command python app.py in the terminal.
- A local server will start, and you will be provided with a link (e.g., http://127.0.0.1:5000).
- Ctrl+Click on the link to open the webpage.
- On the webpage, enter the desired stock symbol and threshold price. Click on the Submit button to register your preferences.
- If the current price of the chosen stock symbol surpasses the threshold, you will be alerted via SMS, email, and Telegram messages.
- To exit the terminal, press Ctrl+C.
In this blog post, we have explored the process of creating a Stock Alert system using the Bolt IoT platform. By integrating Bolt IoT with the Alpha Vantage API, we were able to fetch real-time stock price data and trigger alerts when the prices crossed predefined thresholds. By following the step-by-step instructions provided, you can easily set up your own Stock Alert system and stay informed about the performance of your chosen stocks. Happy trading!
Comments
Please log in or sign up to comment.