A Telegram bot that allows users to check real-time stock prices and view charts of stock data. The bot fetches stock data from Yahoo Finance and responds with the latest stock price and can generate visual plots for stock performance over time.
-
Stock Price Lookup:
Users can enter the ticker symbol of a stock, and the bot will respond with the latest closing price of that stock. -
Plotting Stock Data:
The bot can generate a plot of a stock’s historical data using its ticker symbol and send the generated plot as an image to the user. -
Interactive Commands:
/stock <TICKER>: Returns the latest stock price of the specified ticker./plot <EXPRESSION>: Generates a plot based on a mathematical expression and sends it to the user./hello: Greets the user.
-
Real-Time Data Fetching:
The bot fetches real-time stock price data using the Yahoo Finance API. -
Graph Generation:
Generate custom plots with the help ofmatplotlibfor stock data or mathematical functions.
- Python 3.7+
- Install the necessary libraries:
pip install -r requirements.txtspecify time ranges for historical data.
-
Moving Averages: Add options to calculate and overlay moving averages on stock charts for better trend analysis.
-
Portfolio Tracking: Enable users to track a portfolio of stocks and calculate performance metrics.
-
Improved Plot Customization: Add features like gridlines, annotations, multiple graph themes, and the ability to export high-resolution charts.
-
Alert System: Implement a notification system to alert users about stock price changes or specific thresholds.
-
Search by Company Name: Allow users to search for stock tickers by company name if they don’t know the symbol.
-
Deployment to Cloud Platforms: Provide a guide for deploying the bot on cloud services like AWS, Heroku, or Google Cloud for continuous availability.
User Input:
/stock TSLA
Bot Response:
User Input:
/plot x**3 - 2*x
Bot Response:
(Sends a graph image)
"Here is the plot for the expression x**3 - 2*x over the range x = -10 to 10."
User Input:
/hello
Bot Response:
"Hello there! I’m here to assist you with stock prices and charts."
-
Bot Not Responding:
- Ensure that the Telegram token in the
.envfile is correct. - Verify that the bot is running and connected to the internet.
- Ensure that the Telegram token in the
-
Dependency Issues:
- Make sure all dependencies are installed correctly using
pip install -r requirements.txt. - For any missing packages, try installing them manually.
- Make sure all dependencies are installed correctly using
-
Yahoo Finance API Errors:
- Check if the ticker symbol is valid.
- Ensure that the
yfinancepackage is up to date.
-
Plot Not Rendering:
- Verify that
matplotlibis installed and functional. - Ensure the expression provided in
/plotis valid Python syntax.
- Verify that
We welcome contributions! Here’s how you can help:
-
Fork the repository.
-
Create a new branch for your feature or bug fix:
git checkout -b feature-name