0% found this document useful (0 votes)
57 views

Visualising and Forecasting Stock Prices With Flask

Stock price forecasting and visualisation are critical tasks for investors and traders in financial markets. In this project, we have developed a web application that can visualise stock prices of the company in form of charts and predicts future stock prices using machine learning algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Visualising and Forecasting Stock Prices With Flask

Stock price forecasting and visualisation are critical tasks for investors and traders in financial markets. In this project, we have developed a web application that can visualise stock prices of the company in form of charts and predicts future stock prices using machine learning algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

11 IV April 2023

https://doi.org/10.22214/ijraset.2023.51207
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com

Visualising and Forecasting Stock Prices with Flask


Prof. Ashwini Yerlekar1, Shreyash Urkude2, Nisarg Thool3, Mrunal Maheshkar4, Tushar Gedam5, Subodh Rangari6
Computer Science and Engineering, Rajiv Gandhi College of Engineering and Research, Nagpur

Abstract: Stock price forecasting and visualisation are critical tasks for investors and traders in financial markets. In this
project, we have developed a web application that can visualise stock prices of the company in form of charts and predicts future
stock prices using machine learning algorithms. The web application is built using Flask(python), a popular web framework,
and integrates several APIs and libraries, including News API, Alpha Vantage API, Beautiful Soup (bs4), Pandas, Numpy,
Plotly, and Scikit-learn. The application provides users with a basic overview of the company, current prices of the stock, news
related to the company, and visualisations of historical stock prices in the form of charts. The historical stock prices are fetched
using Alpha Vantage API, and the charts are generated using Plotly library. The web application also includes a predictive
model built using Support Vector Regression (SVR) algorithm which forecasts the stock prices.
This paper demonstrates the potential of machine learning algorithms and web technologies in the field of stock price
forecasting and visualisation. The web application developed, provides users with valuable insights and information related to
stock prices, and it can be used as a powerful tool in financial markets.
Keywords: Flask, Support Vector Regression, Forecasting, Visualisation, Stock Market.

I. INTRODUCTION
A multifaceted and volatile system, the stock market can be affected with a variety of factors including economic factors, political
happenings, and public sentiment. Given that prices fluctuate constantly, it falls upon traders and investors to leverage available
information intelligently to optimize profit while minimizing exposure to risk. Among stock trading's foremost challenges is
forecasting future stock values accurately. Increasingly, researchers have been pursuing machine learning algorithms to predict
stock prices. Through sophisticated analyses of historical data into the patterns and trends underpinning stock price behaviors, these
algorithms provide ways to anticipate future fluctuations in those prices using multiple techniques; among them, support vector
regression (SVR), random forest regression (RFR), and cutting edge deep learning strategies employing architectures like long
short-term memory (LSTM) networks. We have developed a web application that can visualise stock prices and forecast future
prices. The historic stock-price data is pulled from Alpha Vantage API and users can utilize a range of charts to illustrate this data.
Additionally, we implemented an SVR-based model, which can predict stock prices for the upcoming week.

II. LITERATURE REVIEW


1) A comparative Study on Techniques used for Prediction of Stock Market: The author “ Lakshmi Tharun Ponnam” has tried to
develop a model that helps to forecast the future stock market value prediction based on the collection of monthly stock data
using the ARIMA model .
2) Stock Market Prediction using Time Series Analysis: The authors “N Viswam and G Satyanarayana Reddy” have used TIME
SERIES ANALYSIS to develop the model for prediction of stock market prices.TIME SERIES ANALYSIS is one of the most
effective to predict the stock price.
3) Study on the Prediction of Stock Price Based on the Associated Network Model of LSTM: The author “Liang Xi qin” has used
the associated network model of LSTM to form the application to predict the stock prices. The Long Short-Term Memory
(LSTM) network works well on sequence data with long-term dependencies due to the internal memory mechanism.
4) Sentiment Analysis for Indian Stock Market Prediction using Sensex and Nifty: The author “Aditya Bhardwaj” has used
Sentiment Analysis for Indian Stock market prediction indicators such as sensex and nifty, to predict the price of the stock.
5) Visualizing, Comparing and Forecasting Stock Market Prediction: The author “Nirbhey Singh Pahwa” proposes a system for
stock Prediction using Machine learning here linear regression and logistic regression is used for stock price prediction and
stock analysis.
6) Visualizing and Forecasting Stocks Using Dash: The author “Sachin Mishra” has used a machine learning algorithm to predict
the upcoming stock prices. The author developed this simple project idea using dash library in paper Visualizing and
Forecasting Stocks Using Dash..

©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4113
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com

7) Price Prediction of Share Market using Artificial Neural Network: The author “Zabir Haider Khan” discusses the analyses of
various statistical models, Artificial Neural Networks are analogous to nonparametric, nonlinear, regression models. The author
used Backpropagation algorithm for training sessions and Multilayer Feedforward network as a network model for predicting
price.
8) Stock Market Prediction using Machine Learning: The author “V Kranthi Sai Reddy” uses a machine learning technique called
Support Vector Machine (SVM) to predict stock prices for the large and small capitalizations. The programming language used
to predict the stock market using machine learning is Python.
9) Stock Prediction Using Machine Learning Algorithms: The author “P.P.S. Kolhi” proposed the use of macroeconomic factors
such as commodity price, market history, and foreign exchange rate to predict the Bombay Stock exchange (BSE). The project
is implemented in Ipython Notebook.
10) Predicting Stock Market Price Using Support Vector Regression: The author “Phayung Meesad” uses Support Vector
Regression (SVR) as an machine learning algorithm in order to predict the stock market price as well as to predict stock market
trend.

III. PROBLEM STATEMENT


Predicting stock prices has always been a challenging task due to the dynamic nature of financial markets coupled with their
inherent complexity. In addition, users require intuitive tools for projecting and illustrating stock information that are also efficient.
This study aims at addressing these issues by building a Flask-based application capable of forecasting stocks accurately while
delivering high-quality visuals as well as expediting investor’s decision-making process.

IV. PROPOSED WORK


1) Data Collection: The first step in our methodology involves collecting the data required for visualising and forecasting stock
prices. We scrape the “Google Finance” website for collecting basic company information and current price of the stock using
Beautiful Soup. We also used News API for fetching the latest news articles regarding the company the user is interested in. In
addition to that, Alpha Vantage API was used to retrieve historical stock prices for the company or stock specified by the user.
2) Visualisation of Collected Data: The basic information of the company will be displayed to the user like - company overview,
current price and top three news articles regarding the company. The historical stock price data was used to generate line and
candlestick charts using the plotly library. The line chart shows the closing prices of the stock over a specified period, while the
candlestick chart shows the open, close, high, and low prices of the stock for each day.
3) Stock Price Forecasting: We developed a machine learning model based on the SVR algorithm using the scikit-learn library to
forecast future stock prices. The model takes as input the preprocessed historical stock price data which is stored in a CSV
file.The forecasted prices for the next 7 days are then generated by the mode which are later visualised as charts using plotly.
4) Web Application: The entire project was developed in Flask (a web framework in Python). The frontend was designed in
HTML, CSS and Bootstrap (a CSS framework) to provide users with an interface for visualising and forecasting stock prices.
Overall, our methodology provides an end-to-end solution for visualising and forecasting stock prices using machine learning
algorithms.
V. FUTURE SCOPE
While our proposed work provides a valuable tool for visualising and forecasting stock prices for Indian markets, there are several
avenues for future research and development. Some of the potential future scopes are:
1) International Markets: As it stands, our current focus lies primarily within India's flourishing stock market. However, we
strongly believe that further analysis could be conducted utilizing data sources from global financial hubs around the world
including but not limited to: The New York Stock Exchange, Tokyo Stock Exchange and London Stock Exchange. Expanding
our research in this way would naturally enable us to present a more robust perspective on worldwide fiscal landscapes which in
turn may aid investors seeking out particularly advantageous opportunities for investment across borders.
2) Cryptocurrency: While the current limitations of this project only allow its application to be directed towards traditional stock
markets, it still boasts a vast potential within the cryptocurrency industry. Through similar methodologies, investors can gain
beneficial insights into navigating volatile markets such as Bitcoin, Ethereum and Litecoin, providing them with informed
investment decisions.

©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4114
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 11 Issue IV Apr 2023- Available at www.ijraset.com

3) Sentiment Analysis: By harnessing the power of social media analytics alongside sophisticated algorithms designed specifically
for attaining essential insights into user opinions, investors can obtain critical information in real-time. With effective sentiment
analysis techniques applied to platforms like Twitter and Facebook, unique opportunities arise for making well-informed
decisions based on current market sentiments at any given moment.
4) Advanced Machine Learning Models: To forecast stock prices, we employ a Support Vector Regression (SVR) model as the
base of our approach; nevertheless, there exist numerous additional advanced machine learning models such as Random
Forests, Gradient Boosting and Long-short term memory (LSTM), which could be useful in increasing the accuracy rate of
forecasting models.
5) Integration of Financial Statements: An integral part of evaluating a company's financial status is analyzing multiple documents
including balance sheets, income statements, and cash flow statements. Utilizing these materials provides additional depth that
may help shareholders form understanding and facilitate intelligent decision-making with regard to investments.

VI. CONCLUSION
This research paper proposes a web application as a solution to visualize and forecast stock prices using past data. By means of our
approach, we have been able to demonstrate that one can predict future price movements over a period of seven days. This system
takes into account machine learning algorithms and data visualization tools to implement such functionality.
The potential applications of our proposed work encompass various fields, among which are stock trading and portfolio
management. Enabling users with precise forecasts of stock prices, our approach presents an opportunity to inform intelligent
investment decision-making and amplify overall returns.
Investors, traders and financial analysts can benefit from the web application developed in this work. Furthermore, our approach can
be expanded to incorporate more complex machine learning models/ algorithms and data sources.

VII. ACKNOWLEDGEMENT
We are indebted to our mentor, Prof. Ashwini Yerlekar, whose exceptional guidance brought our project to fruition. Her invaluable
advice and unwavering support have empowered us to achieve our goals.
We extend our gratitude to Dr..Hemant Turkar, HOD CSE at RGCER, Dr. Sachin Mahakalkar, Dean Academics at RGCER, and Dr.
Manali M. Kshirsagar, Principal of RGCER, for their gracious assistance and unwavering encouragement.

REFERENCES
[1] Visualizing and Forecasting Stocks Using Dash by Sachin Kumar Mishra (2022). International Journal of Advanced Research in Science, Communication and
Technology (IJARSCT) Volume 2, Issue 1, May 2022. DOI: 10.48175/568
[2] Predicting Stock Market Price Using Support Vector Regression by Phayung Meesad (2013). 2013 International Conference on Informatics, Electronics and
Vision (ICIEV DOI: 10.1109/ICIEV.2013.6572570
[3] Visualizing and Forecasting Stocks Using Machine Learning by Ajitkumar Jagtap, Yash Patil, Darshan Oswa(2022). DOI:
10.22214/ijraset.2022.41846
[4] Data Visualization and Stock Market and Prediction by Ashutosh Sharma, Sanket Modak, Eashwaran Sridhar (2019)
[5] A Comparative Study On Techniques Used For Prediction Of Stock Market by Lakshmi Tharun Ponnam, Dr. V. Srinivasa Raob, BalaKrishna Reddy Gujjuc
(2016). 6th International Conference On Advances In Computing & Communications, ICACC 2016, 6-8 September 2016, Cochin, India.
[6] Using neural networks to forecast stock market prices by Ramon Lawrence (1997).
[7] Stock Market Prediction Using Machine Learning by Kranthi Sai Reddy Vanukuru (2018). DOI:10.13140/RG.2.2.12300.77448
[8] Stock Market Prediction Using Machine Learning by Himanshu Dhiman, Lokesh Chouhan (2018) DOI: 10.1109/ICSCCC.2018.8703332
[9] Prediction of Trends in Stock Market using Moving Averages and Machine Learning by Shoban Dinesh , Samhitha R, S.P. Anusha DOI:
10.1109/I2CT51068.2021.9418097
[10] Flask Documentation - flask.palletsprojects.com/en/2.2.x/
[11] Beautiful Soup Documentation - crummy.com/software/BeautifulSoup/bs4/doc
[12] Plotly Documentation - plotly.com/python/
[13] News API Documentation - newsapi.org/docs
[14] Alpha Vantage API Documentation - alphavantage.co/documentation/
[15] Scikit-learn Documentation - scikit-learn.org/0.21/documentation.html

©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 4115

You might also like