The Stock Market Tracker and Visualizer is an application that provides users with up-to-date stock information and historical performance insights for various companies. It enables users to track selected stocks, analyze historical trends, and compare multiple stocks over time. Users can easily monitor the stock market and visualize changes, helping them make informed decisions.
Operating systems supported are Windows, Mac and Linux 1) To run it on Windows - -> Open terminal and run the command - python .py 2) To run it on Mac/Linux - -> Open terminal and run the command - python3 .py
To run the application the following softwares are required:
This project requires Python 3.x.
For Windows:
- Visit the official Python download page.
- Download the latest version of Python for Windows.
- Run the installer, and make sure to check the box that says "Add Python to PATH".
- Click Install Now.
For macOS:
- Visit the official Python download page.
- Download the latest version of Python for macOS.
- Open the
.pkginstaller and follow the on-screen instructions.
For Linux (Ubuntu):
- Open the terminal and run the following commands:
sudo apt update sudo apt install python3
VS Code is a free, open-source code editor that is widely used for Python development. Below are the installation steps for different operating systems.
For Windows:
- Visit the official VS Code download page.
- Click on the "Download for Windows" button to get the installer.
- Run the installer and follow the installation prompts.
- Important: During installation, make sure to check the box that says "Add to PATH" (this makes it easier to launch VS Code from the terminal).
- Once the installation is complete, open Visual Studio Code from the Start menu.
For macOS:
- Visit the official VS Code download page.
- Click the "Download for macOS" button to download the
.zipfile. - Open the
.zipfile and drag Visual Studio Code to the Applications folder. - Open VS Code from the Applications folder or by searching via Spotlight.
For Linux (Ubuntu/Debian-based distributions):
- Open the terminal and run the following commands to install VS Code:
sudo apt update sudo apt install software-properties-common apt-transport-https curl curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo mv packages.microsoft.gpg /usr/share/keyrings sudo add-apt-repository "deb [signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" sudo apt update sudo apt install code
pip (Python Installs Packages) is Python's package manager, used to install, manage, and uninstall Python libraries and dependencies. It simplifies the process of handling external libraries in your Python projects.
pip is generally by default installed along with modern versions of python(3.4 and newer) However, to manually install it, the following command has to be run on terminal
- For windows - python get-pip.py
- For Linux(Ubuntu/Debian-based distributions) - sudo apt update sudo apt install python3-pip
- For Mac - sudo easy_install pip If python3 is already installed, the following command can be run - python3 -m ensurepip --upgrade
-
Main page has a client login button which the user has to click to login and an exit button to close the application
-
The user is expected to login if he has already registered. Else, there is an option for signup as well, where the user can set his username and password. The username and password of every new user is stored in a database "users".
-
After logging in, users are redirected to a dashboard. The dashboard displays the latest top stories and news related to the stock market. At the top of the dashboard, there is a navigation bar featuring buttons for various functionalities. They are:- -> Mystocks -> Add stock -> Delete stock -> Your Trade Guide -> Compare Stocks -> Exit Functionality of each button is discussed below
-
Functionalities:
-> MyStocks: - Displays the symbols of all the stocks that the user has added as buttons - Clicking a button redirects the user to a window displaying an interactive candlestick plot of stock price versus date.The window also shows the current stock price and provides key company details, including its sector and industry. - There's a 'Back to MyStocks' button that directs the user back to MyStocks.
-> Add Stock: - User can enter a stock here, which he wants to add into his MyStocks List. - User has to enter his username, stock symbol, the company name and click add stock. - This adds the details entered into a database "stocks". - On the basis of username, the details of the stock are queried from the database(used in MyStocks and Comparison) - 'Back to dashboard' button directs the user back to the dashboard.
-> Delete Stock: - User needs to enter his username and stock symbol that he wants to delete. - Upon clicking on Delete Stock, on the basis of the username, stock symbol, the stock is deleted from the database The same is reflected in MyStocks.
-> Your Trade Guide: - Gives recommendation to users for selling or investing in stocks - There are 2 buttons - Invest, Sell - User needs to click on invest if he has plans on investing in any stock(neednot be the stocks that he has in MyStocks). A new window opens where the user needs to enter the symbol of the stock he plans to invest in and the company name.Upon enter, the following recommendations can be given: -The stock has increased significantly, consider investing. -The stock price is stable, making it a safer investment. -The stock has had a significant peak, but be cautious. -The stock is inconsistent, consider holding off on investment. These recommendations are given after analysing last one month of stock data. From the data, we extract the highest price, latest price, %change in price(previous day to present day) and the standard deviation(STD) of closing price over the month. The STD of the stock highlights the consistency of prices. - User needs to click on sell if he has plans on selling any of the shares he has. A new window opens where the user needs to enter the symbol, companyname and date on which he had bought the shares. Upon enter, the application suggests on whether to go ahead and sell the stock or not. It also suggests whether to sell at once or wait for some time to lock in more profits, depending upon the market performance.
-> Compare Stocks: - Users can compare any two stocks from their "MyStocks" list. A dropdown menu allows them to select the symbols of the two stocks they wish to compare. They can also specify the time interval for the plot (from date to date) and choose the periodicity (daily, weekly, or monthly).
-> Exit: - Directs the user back to the main page.
-
Libraries and Modules:
Ensure that all these libraries and modules are installed. Otherwise run: pip install <library/modulename> in terminal
- customtkinter : Building GUI
- pillow : Image processing
- pandas : Data manipulation, analysis
- matplotlib : Data Visualisation through plots(candle stick, line graphs)
- subprocess : For running system commands
- sys : For access to variables and methods that interact with Python runtime environment
- sqlite3 : Database Management System
- requests : Making HTTP requests
- webbrowser : High-level interface to allow displaying web-based documents to the user in their default web browser
- threading : Run multiple threads (smaller units of a process) concurrently in a program
- yfinance : Retrieving data from Yahoo Finance API
- tkinter : Used just for the messagebox
-
APIs:
- Yahoo Finance API : Retriving stocks data
- News API : Extracting stock market news
-
Databases:
- users : Database that stores the user information (username and password)
- stocks : Stores the stocks the user wants to track. Consists of username, stock symbol and company name
-
Stocks.py : Creates the Stocks class with symbol and company name and defines the following methods - get_historical_data :Extracting the historical data of the concerned stock. Returns a Pandas data frame with the data - get_latest_data :Extracting the latest data of the concerned stock. Returns a dictionary with the data - namely symbol,latest price and latest date as key - calculate_price_change : Percentage change in the price is calculated. Returns the percentage change
-
Datafetcher.py : Creates Datafetcher class with symbol and stocks-ticker object from yfinance. Has the following methods - get_historical_data: Extracts hitorical data from Yahoo Finance API - format_historical_data: Formats the pandas dataframe - get_latest_price: Extract current stock price - get_stock_data: Extract details about the sector, industry etc.
-
ClientLogin.py , ClientSignUp.py : contains ClientLogin and ClientSignup classes respectively. Used to build the login and signup interfaces respectively
-
Dashboard.py : contains dashboard class. Used to build the dashboard for the application
-
AddStock.py : contains AddStock class. Used to add stocks to the database "stocks"
-
DeleteStock.py : contains DeleteStock class. Used to delete stocks previously saved
-
MyStocks.py : contains MyStocks class. Used to display all the stocks saved by a user
-
Visualiser.py : contains Visualise class. Displays candle stick plot for a stock chosen by the user in MyStocks.py
-
StockGuide.py: contains StockGuide class. Gives the user an option to choose whether he wants recommendations for selling or investing.
-
Sell.py and Sell_backend.py: Recommendations for selling stock entered by user
-
Invest.py and Invest_backend.py : Recommendation for investing in stock entered by user
-
Comparison.py: Comparing 2 stocks
NOTE - There are some text files as well, in the STOCK MARKET folder. These have been used just to hold user data on a temporary basis.