This Telegram bot allows you to track stock sentiment for a list of companies. It fetches news headlines related to the stocks and uses OpenAI's GPT-3.5-turbo model to analyze the sentiment of each headline. The bot then calculates an average sentiment score for each stock and sends a daily summary message to a specified chat.
- Add and remove companies from the tracking list
- List all the companies currently being tracked
- Run sentiment analysis on the tracked companies
- Daily sentiment summary messages
-
Clone the repository:
bashCopy code
git clone https://github.com/your-repo/stock-sentiment-analysis-bot.git cd stock-sentiment-analysis-bot
-
Install the required packages:
Copy code
pip install -r requirements.txt
-
Set up environment variables:
-
Create a
.env
file in the root directory of the project. -
Add the following environment variables with your API keys and Telegram chat ID:
makefileCopy code
EOD_API_KEY=your_eod_historical_data_api_key OPENAI_API_KEY=your_openai_api_key TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id
-
-
Follow these instructions to retrieve your Telegram Bot Token and Telegram Chat ID:
https://docs.influxdata.com/kapacitor/v1.5/event_handlers/telegram/#get-your-telegram-chat-id
-
Start the bot:
cssCopy code
python main.py
-
Interact with the bot using the following commands:
/add_company <company_ticker> <company_name>
: Add a company to the tracking list./remove_company <company_ticker>
: Remove a company from the tracking list./list_companies
: List all the companies currently being tracked./get_sentiments
: Run sentiment analysis on the tracked companies.
- Add a company(ies) to the list:
/add_company AAPL
OR/add_company APPL, SBUX, MSFT, TSLA
- Remove a company from the list:
/remove_company AAPL
- List all the companies:
/list_companies
- Get stock sentiments from your list:
/get_list_sentiments
- Get sentiments for a list of companies that may or may not be in your list:
/get_sentiment AAPL, SBUX, MSFT, TSLA
If you have any questions, need assistance, or want to request new features for the Stock Sentiment Analysis Telegram Bot, please feel free to open an issue on the GitHub repository or contact the bot developer.
We welcome contributions to improve the Stock Sentiment Analysis Telegram Bot. If you'd like to contribute, please follow these steps:
- Fork the repository on GitHub.
- Create a new branch for your changes.
- Make your changes and commit them with descriptive commit messages.
- Push your changes to your fork.
- Create a pull request from your fork to the original repository.
Before creating a pull request, please make sure your changes are well-documented and tested.
The Stock Sentiment Analysis Telegram Bot uses:
- OpenAI's GPT-3.5-turbo model for sentiment analysis
- EOD Historical Data API for fetching news headlines
- Aiogram for the Telegram bot framework
- APScheduler for scheduling daily sentiment summary messages
We would like to thank the developers and maintainers of these libraries and services for their contributions to the open-source community.
This project is licensed under the MIT License.