- Introduction
- Available Commands
- How to Use
- How to Set Up the Bot
- Warning Price
- Database
- Open VScode tunnel
- Summarize Sound
- Summarize News
- Example Uses
- To-Do List
Welcome to the Mrzaizai2k Stock Assistant bot! This bot is designed to assist you with various stock-related tasks and analyses. Whether you want to calculate the payback time for a stock, find support and resistance levels, or receive warnings about specific market conditions, this bot has you covered.
/start
: Initializes the bot and provides a welcome message./help
: Displays a list of available commands and their descriptions./pbt
: Calculates the payback time for a specific stock./snr
: Finds the closest support and resistance levels for a stock./findpbt
: Identifies stocks with favorable payback times./findmyfav
: Recommends stocks based on specified criteria./risk
: Calculates the number of stocks you can buy with a given loss/trade percentage and maximum loss/capital percentage./rate
: Provides a general rating for a stock./mulpattern
: Finds patterns of a stock on multiple dimensions (close, volume)./pattern
: Finds patterns of a stock based on closing prices./findbestmotif
: Identifies the best motifs across all stocks./buysellanalyze
: Picture of my Buy/Sell of a stock (FPTS data)/winlossanalyze
: Analyze my Win/Loss trading for the last 6 months (FPTS data)/watchlist
: See/change your watch list/winlossanalyze
: Analyze my Win/Loss trading for the last 6 months (FPTS data)/remote
: Open remote tunnel to vscode on my latop.
- Start a command with a forward slash ("/") followed by the desired command.
- Example:
/pbt
- Example:
- Follow the bot's prompts to enter additional information, such as stock symbols or dates.
- Wait for the bot to process your request. Some commands may take several minutes.
- Review the bot's responses for the calculated results, warnings, or recommended stocks.
Before running the Mrzaizai2k Stock Assistant Bot, follow these steps to set up the environment:
-
Clone the Repository:
- Close the Git repository to your local machine:
git clone [repository_url]
- Close the Git repository to your local machine:
-
Install Dependencies:
- Navigate to the project directory and install the required packages using the provided
setup_win.txt
file:pip install -r setup_win.txt
- Navigate to the project directory and install the required packages using the provided
-
Get TELEBOT_API Key:
- Go to BotFather on Telegram and create a new bot.
- Copy the generated
TELEBOT_API
key.
-
Create .env File:
- Create a new file named
.env
in the project root directory. - Add the following line to the file, replacing
YOUR_TELEBOT_API_KEY
with the key obtained from BotFather:TELEBOT_API=YOUR_TELEBOT_API_KEY TRADE_USER=YOUR_TRADING_USER TRADE_PASS=YOUR TRADING PASSWORD
- Create a new file named
-
Update Config:
- You have to update the config in
config/config.yaml
file. i.e time to warning, data path,...
- You have to update the config in
-
Run the Bot:
-
Execute the following command to run the Mrzaizai2k Stock Assistant Bot:
python src/stock_bot.py
-
Or you can run with Makefile on Linux:
make bot
-
-
Interact with the Bot:
- Once the bot is running, open Telegram and start interacting with the bot using the available commands.
The bot can also warning you about the stock in watchlist in times that you have set in config/config.yaml
-
warning_macd
Function:- Purpose: This function generates warnings based on MACD (Moving Average Convergence Divergence) analysis for stocks in the provided watchlist.
- Warnings: Detects if a stock has crossed up or down based on MACD with a specified offset.
-
warningbigday
Function:- Purpose: Generates warnings for stocks with significant price movements (big days).
- Warnings: Identifies powerful increases or decreases in stock prices.
-
warningpricevsma
Function:- Purpose: Provides warnings based on the relationship between stock prices and Moving Averages (MA).
- Warnings: Detects if a stock has crossed up or down in relation to its Moving Average with a specified offset.
-
warningsnr
Function:- Purpose: Warns about stocks approaching or meeting support/resistance levels.
- Warnings: Identifies if a stock is meeting support or resistance levels within a specified tolerance percentage.
-
User database:
The chatbot utilizes a user database stored in
./memory
. When a new user executes the/watchlist
command, the chatbot automatically checks if the user is in the database. The database contains the following information:- user_id: Unique identifier for users.
- watch_list: List of stocks associated with each user.
- step: User's progress step in the chatbot's functionality.
This user database is a crucial component, enabling seamless interactions and personalized experiences for users. The database is actively used in various functions throughout the bot.
-
Scrape data trading:
The chatbot employs Selenium to scrape trading data from FTPS. The scraped data provides insights into buy/sell periods and facilitates analysis of win/loss trading patterns. The code for this functionality is available in src/trading_record.py. This feature enhances the chatbot's capability to provide valuable trading analytics. The code can be found in
src/trading_record.py
As to this link, you need to first set up the tunnel in your code
curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz
tar -xf vscode_cli.tar.gz
Then use this command in CLI
./code tunnel
Or in the src/stock_bot.py
result = subprocess.run(command, check=True, text=True)
The bot is in development to summarize all sounds from audio or voice
.It can recognize sounds with various formats such as .mp3, .wav,.ogg,.m4a
with Whisper
To setup Whisper
pip install git+https://github.com/openai/whisper.git
# on Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg
Then I use Google Translate API to translate the text to English. All the code can be found src/summarize_text.py
I am trying some summarize model but has some withdraws (the model is too big, or too dump)
The bot can also summarize news for stocks in your watch list
Explore practical implementations and demonstrations of the chatbot's functions in the notebook
folder. These examples showcase real-world scenarios, illustrating how the chatbot can be effectively utilized for stock market monitoring.
-
Stock Prediction with TFT Model
-
Automated Data Scraping
-
User_ID Encryption
-
Back Testing Bot
-
Summarize voice
Note: Ensure that you have Python installed on your machine and the necessary permissions to install packages and run scripts.
Feel free to explore the various commands and leverage the bot for your stock-related analyses. If you have any questions or encounter issues, type /help
for assistance. Happy investing!