Skip to content

A Stock prediction application using python libraries and Yahoo finance

Notifications You must be signed in to change notification settings

KushBhandari15/Stock-Prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Prediction Application

This project is a Stock Prediction application built using Streamlit, which allows users to predict stock prices for various companies. Users can input the ticker symbol of a stock, select a start date, and specify the number of years for which they want to forecast the stock price. The application retrieves historical stock data using the Yahoo Finance API, processes it using the Prophet library, and generates forecast data along with interactive visualizations. The goal of the project is to provide users with insights into future stock price trends to aid in investment decision-making.

Table of Contents

Introduction

The Stock Prediction Application is a user-friendly tool built using Streamlit, designed to empower users to forecast stock prices for various companies effortlessly. By leveraging historical stock data from the Yahoo Finance API and the advanced forecasting capabilities of the Prophet library, users can gain insights into potential future trends in stock prices. This application aims to assist investors in making informed decisions by providing them with reliable predictions of stock price movements.

Utilizing Streamlit's intuitive interface, users can input the ticker symbol of the stock they wish to analyze, select a start date for historical data retrieval, and specify the desired forecast period. The application then processes the data, trains a Prophet model, and generates forecasted stock prices. Users can visualize both the historical data and the forecasted prices through interactive charts and tables within the application.

Installation

  1. Clone the repository:
    git clone https://github.com/KushBhandari15/Stock-Prediction
    
  2. Navigate to the project directory:
    cd <project_directory>
    
  3. Install dependencies:
    pip install -r requirements.txt
    

Usage

Inside Terminal

  1. Open your terminal and navigate to your project directory
    cd <project_directory>
  2. Run your code by using the following code
    py -m streamlit run <filename.py>
  3. You will be provided by a link to your application

image

Inside application

  1. Enter a start date and a ticker name

image

Note: If ticker name is not found it would print "Data is empty! Please check if right ticker is entered"

  1. Choose number of years of forceast data you need using the slider

image

  1. Finally when all the data has been entered you can view the current data of the stock (displayed as raw data) and as well as its forecast which is displayed through both simple data table and graphs

image

image

image

image

image

Testing

Automated Testing

We have included some automated test cases to verify the functionality of the test_stock_prediction function in the unit_test.py file. These test cases cover various scenarios, including selecting invalid stocks, selecting valid stocks with different forecast durations, case-sensitive inputs, and empty inputs.

To run the automated tests, you can execute the unit_test.py file using the following command:

python unit_test.py

Custom Testing

If needed, you can also create your own test cases by modifying the input parameters in the unit_test.py file and running the tests again. Ensure to provide valid input parameters for the stock ticker, start date, and forecast duration to test different scenarios. The test results will indicate whether each test case passed or failed.

Contributing

We welcome contributions from the community to improve this project. If you'd like to contribute, please follow these guidelines:

  1. Fork the repository on GitHub.
  2. Clone your forked repository to your local machine:
    git clone https://github.com/your-username/your-repository.git
    
  3. Create a new branch for your changes:
    git checkout -b feature-name
  4. Replace feature-name with a descriptive name for your feature or fix.
  5. Make your changes in the codebase.
  6. Test your changes thoroughly to ensure they work as expected.
  7. Commit your changes:
    git commit -am 'Add new feature' 
  8. Push your changes to your forked repository:
    git push origin feature-name
    
  9. Submit a pull request (PR) from your forked repository to the main branch of the original repository. Provide a clear title and description for your PR, explaining the purpose of the changes. Reference any related issues or pull requests, if applicable. After submitting your pull request, it will be reviewed by the project maintainers. Please be patient, as it may take some time for your PR to be reviewed. We appreciate your contribution to the project!

Note: Please ensure that your changes adhere to the project's coding style and conventions. Also, avoid making unrelated changes in your pull requests. If you're unsure about anything, feel free to ask for clarification in the PR discussion.

About

A Stock prediction application using python libraries and Yahoo finance

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published