Optimized Price Prediction for Equity Stocks

Download Full-Text PDF Cite this Publication

Text Only Version

Optimized Price Prediction for Equity Stocks

Salman Yusuf Shaikh

Department of Computer Engineering,

K.J. Somaiya College of Engineering, Vidyavihar, Mumbai- 400077.

Kavita Kelkar

Department of Computer Engineering,

    1. Somaiya College of Engineering, Vidyavihar, Mumbai-400077.

      Abstract:- The Collection/Aggregtion of buyers and sellers of stocks or the stock market, which represent ownership claims on businesses, is known as a stock exchange or equity market. These can include securities listed on a public stock exchange as well as stock that is only traded privately, such as shares of personal companies sold to investors through equity crowdfunding platforms. Stock market prediction is that the act of trying to find out the long term / short term value of a company stock or other financial instrument or index traded on an exchange. The concepts of numerous technical indicators are used to historical data from the Indian Stocks segment in order to get relevant knowledge and insights into the kind of approach, which may aid users in making correct buying and selling decisions while trading specific Stocks. This talent offers the expert trader a significant advantage over inexperienced traders. Fundamental Analysis is the art of evaluating the actual value of a stock to seek out long-term investing opportunities. This paper describes exhaustive study on how fundamental analysis and technical analysis on stock can be performed to get optimized results on equity stocks by using python as a programming and scripting language. The different ways of doing sentiment analysis and balance sheet reading for stock prediction are also discussed. Also, many stock prediction strategies are given which helps in predicting accurate stock prices,

      Keywords: – Stock Price Prediction, Fundamental analysis, technical analysis, RSI, Moving average.

      1. INTRODUCTION

        The stock market is a set of marketplaces and exchanges where publicly listed business shares are bought, sold, and issued on a regular basis. Such financial transactions take place on regulated official exchanges or over-the-counter (OTC) marketplaces. During a rustic or an area, there are frequently several stock trading venues that allow trades in stocks and other types of assets.

        The stock markets have offered outstanding investment returns throughout the years, but novice traders aren't ready to take advantage of them due to their concern with shifting markets and losing money. The concepts of numerous technical indicators are used to historical data from the Indian Stocks segment in order to get relevant knowledge and insights into the kind of approach, which may aid users in making correct buying and selling decisions while trading in specific Stocks. This talent offers the expert trader a significant advantage over inexperienced traders. The use of sentiment analysis, fundamental analysis is also done. The goal of this project is to help inexperienced stock exchange users choose stocks and make better stock decisions.

        Fundamental analysis for equities considers sales, profits, future growth, return on equity, profit margins, and other factors to determine a company's underlying worth and

        future development potential. All of this information regarding a company's financial statements is disclosed once a year. So, during this project for fundamental analysis we use companys financial statements and sentiments of individuals about the corporate.

        Technical analysis is the study of historical market data such as price and volume. Using principles from market psychology, behavioural economics, and quantitative chemical analysis, technical analysts attempt to anticipate future market behaviour based on recent performance. Technical indicators such as the RSI, Moving Average, Bollinger Bands, and others are employed.

        Fig.1. Chart Pattern

        This paper is to safeguard the portfolio from any market speculations for long term as well as short term. To train a Retail Investor on maintain the risk as low as possible by deploying technical indicators and by helping them in fundamental analysis.

        Python has become one of the foremost popular programming languages for several Companies. Its simplicity and robust modelling capabilities make it an outstanding tool for researchers, analysts, and traders. Python continues to remain one of the foremost demanded programming languages within the stock market industry We use python for technical analysis as well as fundamental analysis.

      2. LITERATURE SURVEY

        Stock Prices was previously only predicted using fundamental analysis. The annual report (AR) is a yearly publication that is sent to shareholders and other interested parties by the firm. The annual report is issued at the end of the financial year, and all of the data included within it is dated as of March 31st. The Annual Report is generally accessible as a PDF document on the firm's website (in the investor's area), or you may contact the company to request a hard copy.

        Annual report usually contains the following nine subpoints: The Monetary Highlights, the Administration Statement, The Administration Discussion & Analysis, The Monetary Highlights, Financial highlights during the last ten years, Financial Section, Notice, Corporate Information, Director's Report, Corporate Governance Report.

        Another way of performing fundamental analysis is by looking at the balance sheet & profit and loss statement of the organization. The profit and loss statement informs us about the company's profitability, while the balance sheet informs us about the company's assets, liabilities, and shareholders' equity. As you may know, the P&L statement explains the profitability for the financial year in question. As a result, it's safe to conclude that the P&L statement is self-contained. The balance sheet, on the other hand, is created on a flow basis, which means it contains financial information about the firm dating back to its incorporation. The P&L, on the other hand, describes how the firm fared during a given financial year, whereas the balance sheet discusses how the company has developed financially over time.

        Fig.2. Balance sheet

        Along with fundamental analysis concept of technical analysis emerged to give new way of looking at the stocks. Technical analysis may be applied to any asset class as long as the asset type contains historical time series data, which is one of its most flexible aspects. In technical analysis, time series data refers to information on price variables such as open high, low, close, and volume. The opening price is the initial price at which a trade executes when the markets open for trading.

        The high This is the very best price at which market participants were ready to deal on that particular day.

        The Low This is the very worst price at which market players were willing to trade for the day.

        The most significant price is the close, which reflects the final price at which the market closed for a certain period of time. The close determines the intraday strength. The day is

        positive if the close is higher than the open; otherwise, it is negative.

        To Understand Stocks, we need to study about charts, there are several types of chart pattern, but the most commonly used charts patterns are.

        1. Line chart

        2. Bar Chart

        3. Japanese Candlestick.

        Fig.3. Line Chart of stock

        The simplest basic chart style is the line chart, which is made up of simply one data point. A line chart is crated by charting the closing prices of a stock or an index in technical analysis. Each closing price is represented by a dot, with a line connecting the dots. When looking at 60-day data, the line chart is created by joining the dots of the closing prices for 60 days.

        The bar chart, on the other hand, has a wider range of applications. The four price variables are displayed in a bar chart: open, high, low, and close.

        1. The center line – The top of the bar represents the security's greatest price. The lowest price for the same time is shown at the bottom of the bar.

        2. The open is shown by the left mark/tick. 3.The closing is shown by the right mark/tick.

          Fig.4. Bar of a stock

          In a candlestick the open and close prices are displayed by a rectangular body. In a candlestick chart, candles are often classified as a bullish or bearish candle usually represented by blue/green/white and red/black candles. Needless to mention, the colors are often customized to any color of your choice; Most commonly people opt for the blue and red combination to represent bullish and bearish candles respectively.

          Fig.5. Candle Stick of a stock

      3. HARDWARE AND SOFTWARE REQUIREMENTS According to the algorithms and methodology used, hardware requirements can be very basic with a minimum configuration of Intels Core 2 Duo or above, Windows 7 or above, 2 GB RAM or above, etc.

        Python has become one of the most widely used programming languages by a number of businesses. It's a great tool for academics, analysts, and traders because of its ease of use and powerful modelling capabilities. Python is easy to create and deploy, making it an ideal option for dealing with financial industry applications, which are sometimes quite complicated. Building a trading strategy with Python is now possible. Stock markets create huge quantities of data that need extensive analysis, which Python can assist with. With the assistance of this language, developers can define the winning trading strategies and obtain useful tips associated with the long-term conditions of one or another market. Python, as well as Django and the Flask framework, are frequently used to create software with similar features.

        Usage of Different Python Libraries can be done in python to ensure better accuracy and derive better results the library which are used are: Pandas, Matplotlib, NumPy, etc.

      4. DESIGN METHODOLOGY AND ALGORITHMS

          • Fundamental Analysis

            The fundamental analysis of stock can be very difficult to automate as there are various factors leading to a good fundamental of the company. So, the inspiration is taken by the Piotroskis F-score. The Piotroskis F-score is a number ranging from 0 to 9 that is used to assess a company's financial strength. The score is used by financial investors to choose the simplest stocks with the best value (nine being the best). The score is based on nine factors separated into three groups.

            1. Profitability

              Operating income (positive this year gives one score, 0 if otherwise)

              Return on Assets (positive this year gives one score, 0 if it's not).

              Accruals (Operating Cash Flow/Total Assets is greater than

            2. Leverage, Liquidity and Source of Funds Leverage (long-term) ratio change (the ratio is lower this year compared to the previous one gives one score, 0 otherwise).

              The number of shares has changed (No new shares were issued during the last year gives one score, else 0).

              Change in Current Ratio (If Higher in the current year than the previous one – gives one score, 0 if it is lower).

            3. Operating Efficiency

              Change in Gross Margin (If Higher in the current year than the previous one – gives 1 point, 0 if it is lower).

              Change in Asset Turnover ratio (If Higher in the current year than the previous one – gives 1 point, 0 if it is lower).

              The score is calculated supported the info from budget of a corporation. Every condition that is satisfied earns a company one point. Piotroski's F-score is calculated by adding all of his points (number between 0 and 9). A company with a Piotroski F-score of 89 is considered to be strong. Firms with an F-score of 02 are deemed weak, on the other hand.

          • Technical Analysis

            Various technical indicators can be used in technical analysis. Technical indicators are pattern-based or heuristic signals created by the price, volume, and/or open interest of a security or contract and are utilized by traders that apply technical analysis. By analyzing historical data, technical analysts use indicators to anticipate future price movements.

            1. Relative Strength Index

              The Relative Strength Index (RSI) is one of the most utilized tools in a trader's arsenal. The RSI is an oscillating indicator that compares the amount of an asset's recent gains against its recent losses to determine whether it is overbought or oversold. The Relative Strength Index (RSI) is useful for producing signals to timing entry and exit points by recognizing when a trend is ending or a replacement trend is emerging.

              Fig.6: RSI Strategy for a stock

              The average percentage gain or loss used in the calculation is the average gain or loss over a specified period of time.

              100

              ROA in the current year gives one score, 0 if not).

              Change in Return on Assets (ROA) has changed ( ROA is higher within the current year compared to the previous one gives one score, 0 otherwise).

              = 100 (

              )

              1 +

              The second component of the RSI formula may be calculated after there are 14 periods of data available. The findings are smoothed out in the second phase of the computation.

              = 100 (

              = 100 (

              100

              100

              )

              )

              ( 13)+

              1 +

              [( 13)+ ]
            2. Moving Average Crossover

              On a price chart, a moving average reduces the amount of "noise." Examine the moving average's direction to get a sense of which way the price is trending. If it's slanted up, the value is rising (or was recently); if it's angled down, the price is falling; if it's moving laterally, the price is most likely fluctuating within a range. A moving average can also serve as resistance or support. It functions as support in uptrends and resistance in downtrends.

              When the 50-day moving average crosses the 200-day moving average, a crossover occurs, and the trend is likely to shift.

              Fig.7: Moving Average Crossover Strategy for a stock

            3. Bollinger Bands

            Bollinger Bands are a type of oscillating indicator that is used to gauge market movement. They can help you predict if a price will revert after being particularly high or low in comparison to its previous average. This might be a hint that it's time to shop for or sell a certain item. Bollinger Bands are a set of three bands (lower ,middle and upper) are used to identify excessive short-term prices. Undersold territory is represented by the top band, while underbought territory is represented by the bottom band. The bottom line is that the prices are moving on a simple moving average. Bollinger Bands are commonly used in conjunction with other analytical tools by most professionals to get a clearer understanding of the current status of a market or investment.

            Fig.8: Bollinger Bands Strategy for a stock

      5. RESULTS Function for Relative Strength Index

        Function for Moving Average Crossover

        Function for Bollinger Band

        Comparisons of Implemented Indicators (RSI, MAC, Bollinger Bands, Fibonacci Retracement):

        5 minutes

        Technical Indicator

        Approximate Time Taken to Perform Same Task Manually

        Execution Time Taken by The Python

        Success Rate

        Relative Strength Index

        23 seconds

        76.31%

        Moving Average Crossover

        6 minutes

        30 seconds

        80.33%

        Bollinger Bands

        8 minutes

        25 seconds

        75.12%

        Fibonacci Retracement

        10 minutes

        39 seconds

        90.21%

        According to the comparison shown in the table above are RSI takes round about 5 minutes to perform manually whereas with python it takes approximately 23 sec with the accuracy of 77%. Moving Average Crossover takes round about 6 mins to perform manually whereas with python it takes approximately 30 sec with the accuracy of 80%. Bollinger Bands takes round about 8 minutes to perform manually whereas with python it takes approximately 25 sec with the accuracy of 75%. Fibonacci Retracement takes round about 10 minutes to perform manually whereas with python it takes approximately 39 sec with the accuracy of 90%.

        Fundamental analysis gives us the accuracy of 80% when we use the Piotroskiss F Score. It also tells us about how the financials of the company are, if the score is 0 or 1 then the company is in heavy debt, or they are financially weak and if the score is 8 or 9 then the company is financially strong.

      6. CONCLUSION

As per the findings and literature survey from above journal papers as well as the implementation of the algorithms, we drew the following conclusions as follows: –

    • Technical Indicators play a significant part in the stock market and will continue to do so as it is difficult for humans to calculate all this calculations.

    • When the activities are repetitive, using Python to implement Technical Indicators works effectively.

    • Python is user friendly programming language also, there are many python frameworks which can be used to develop web application and deliver it as a product.

    • Automating all the indicators also eliminate any scope of human error and the accuracy increases.

    • Based on literature survey, many portfolios are most prone to losses because they dont make use of Fundamental analysis and technical analysis in their trading methodology.

Thus, we can merge fundamental and technical analysis to get a better view of the company. This will help retail trader to get a proper idea about the market with actually looking into the charts and will safeguard their portfolio.

ACKNOWLEDGEMENT

Authors would like to thank Principal, K. J. Somaiya College of Engineering for providing all the necessary facilities required for this research.

REFERENCES

  1. Ricardo de Almeida, Gilberto Reynoso-Meza, Maria Teresinha Arns Steiner, Multi-objective Optimization Approach to Stock Market Technical Indicators, 2017 IEEE Congress on Evolutionary Computation (CEC), IEEE 2017.

  2. Thaloengpattarakoon Sanboon, Kamol Keatruangkamala, Maria Teresinha Arns Steiner, A Deep Learning Model for Predicting Buy and Sell Recommendations in Stock Exchange of Thailand using Long Short-Term Memory, 2019 IEEE 4th International Conference on Computer and Communication Systems, IEEE 2019.

  3. Tejas Mankar , Tushar Hotchandani, Manish Madhwani, Stock Market Prediction based on Social Sentiments using Machine Learning, 2017 VES Institute of Technology, IEEE 2017.

  4. Saloni Mohan1, Sahitya Mullapudi1, Sudheer Sammeta1, Parag Vijayvergia1 and David C. Anastasiu, Stock Price Prediction Using News Sentiment Analysis, 2019 IEEE Fifth International Conference on Big Data Computing Service and Applications (BigDataService), IEEE 2019.

  5. Bikrant Bikram P. Maurya, Ayush Ray, Aman Upadhyay, Recursive Stock Price Prediction with Machine Learning And Web Scrapping For Specified Time Period, 2019 Sixteenth International Conference on Wireless and Optical Communication Networks (WOCN), IEEE 2019.

  6. Ajinkya Chaudhari, Parag Ghorpade., Forecasting a firms position based on Pitroskis F-score using ARIMA, 2020 International Conference on Data Analytics for Business and Industry: Way Towards a Sustainable Economy (ICDABI), 2020.

Leave a Reply

Your email address will not be published. Required fields are marked *