VIETNAM NATIONAL UNIVERSITY UNIVERSITY OF ECONOMIC AND BUSINESS FACULTY OF FINANCE & BANKING GRADUATE THESIS: FORECASTING THE VIETNAM STOCK MARKET WITH TEXT MINING APROACHES Supervisors: ThS. Lé Thi Phuong Thao Hanoi, February 2021 ACKNOWLEDGEMENT A completed study would not be done without any assistance. Therefore, the author who conducted this research gratefully gives acknowledgement to their support and motivation during the time of doing this research as a requirement of completing my thesis. The author would like to thank the Board of the University of Economics and Business — Vietnam National University for creating favorable conditions for the author to complete this thesis.
The author also would like to thank the lecturers of the Faculty of Finance and Banking, University of Economics and Business — Vietnam National University for their help the author in the thesis implementation process. In particular, I would like to express my endless thanks and gratefulness to my supervisor Ms. Le Thi Phuong Thao. Her kindly support and continuous advices went through the process of completion of my thesis.
Her encouragement and comments had significantly enriched and improved my work. Without her motivation and instructions, the thesis would have been impossible to be done effectively. Thank you very much! Author/Student Supervisor (Sign, Full name) (Sign, Full name) Ms. Le Thi Phuong Thao Nguyen Ngoc Hai TABLE OF CONTENTS 0400900 @919))00Ề12125255.
Object and scope 20200. 8 A, Thesis Structure oo. 8 CHAPTER 1: THEORETICAL BASIS AND LITERATURE REVIEW.-- Gà HH HH HH HH HT HT nh nh ng 10 1. Stock market anaÏYSIS.-- c1 11919 111 191 111 1v vn TH ngư 10 1.
Text mining apprOaCHh. Introducing the problem of stock market forecasting. Overview of domestic r€S€ATCH. - G111 91 11v 01 T1 vn nh nh nh nh nh nh 34 1.
Overview of foreign T©S€AaTCH.- --- <1 1E 191 HH HH ky 35 CHAPTER 2: PREPROCESSING DA TÁA.-- Tnhh HH nh nh TT ng 39 2. The method of combining the content Of I€WS. Assign news labels to prepare data for the training phase. Eliminate interfering ChaTACẨ€TS.- - G5 119001119301 11910 1190 1 nh nh re 43 2.- -¿- 6 2 6 4k1 TT TH TH TH HH HH HT TH Hiệp 45 2.
Represents NEWS 1n V€CfOT SDACC. - HH HH rờ 46 CHAPTER 3: DEVELOPING TEST PROGRAMS. HH HH ng gi, 48 3.1 Code Editor - Visual Studio Code (Visual Code).- c5 555cc sc+ssseeeeesss 48 3.2 Python programming ÏanØUAØ.3 Beautiful Soup Library 1 .4 Scikit-learn Library. Introduction of MOCUIES 1.
Evaluate the model's accuracy .-- c1 TH TH nh ng rệt 51 3. Testing program nh. Tested on data Sets .- - -- 1L HH HH TH HH HH HT 53 3. Advanced program testing T€SUÏ(S.-- --- - --- + 1+ E21 1991 1911 91 E91 1 1 9 ng ng ng rệt 54 CHAPTER 4: CONCLUSION.
Ác ST T TH TH HH TT TT TT To nh TT ni 57 ›3585)45)I0.” HH TT TH TH HH HH HH TT 66 INTRODUCTION 1. The rationale of the research The stock market in the world in general, and in Vietnam in particular, is attracting more and more investors. According to the Vietnam Securities Depository, only in November 2020, the Vietnamese stock market had over 41,200 newly created accounts (the highest monthly ever). Currently with more than 2.7 million accounts (as of the end of November 2020), Vietnam's stock market is attracting more attention and participating investors want to know more about the future of the market so they could invest more profitably.
Therefore, effective market prediction will bring great benefits both at the macro and micro level, helping brokers to offer trading advice or can be used as parts of the suggestion. For decades, stock market analysis has two approaches: fundamental analysis and technical analysis. The inputs for these methods are historical price data in coordinate with financial indicators. However, these financial indicators and business financial performance are often summarized in a specific period (quarter, half year, year), but news related to a business would likely have an immediate impact on its share price.
For example, when the board of directors of a company announce a merger and acquisition plan next year, this will immediately impact the share prices of the two companies, but in terms of financial data, it will reflect on the next financial reporting period. This demonstrates the fact that news has an evidently strong impact on the stock market, and for an emerging market like the Vietnamese stock market, this impact is even more pronounced. There have been studies using algorithms to analyze market data through technical analysis by using ARCH, GARCH models, etc. In the past, the most popular method applied was regression analysis, but now with the development of science and technology, algorithms related to machine learning have been increasingly applied.
According to Yu et al. (2013), technical analysis can only observe one piece of the overall picture of the market and using only this method of analysis will face many difficulties as it is only applicable in specific circumstances. As for fundamental analysis, it is not only based on historical financial data, but also relies on many other factors such as political situation, business environment, news, etc. These factors can be in a structured number format (numeric data) or it can also be from a textual data format.
Vietnam's stock market has shown a strong development in size, structure and played an important role in promoting the country’s economic development and International integration. With more than 700 stock symbols representing more than 700 listed companies, every day, hundreds of news related to these companies are published on newspapers and social networks. According to the Efficient Market Hypothesis, asset prices reflect all available information and the price of a security will fully reflect its value. However, gathering all this news for each investor is not only a matter of sources but also a matter of time.
According to a speed test sponsored by Staples, an adult has an average reading speed of 300 words per minute. On average, each A4 sheet has between 400 and 500 words. Therefore, to read a 20 pages document, a person needs at least 30 minutes and even more time to understand, analyze, and summarize that amount of information. However, the increasing amount of information published on the Internet has increased the demand for tools to help readers search and summarize information (Aas and Eikvil (1999)).
In fact, in today's information proliferation, readers can be exposed to countless different news outlets every day. These sources can have news directly related to the financial situation of a market, a business or also indirectly related to that business through articles about private life, the business meetings with other businesses or even occasional (possibly unverified) news circulating on social networks. This information can have a direct effect on a market or a business. For example, in 2013, the news that Mr.
Tran Bac Ha - Chairman of BIDV Bank's Board of Directors being arrested was spread on the morning of February 21, 2013. Immediately, a series of stocks were sold off. The VN- Index fell by 18 points and the HNX-Index fell by 3. The stock market capitalization has lost VND29,000 billion in one session.
After a period of investigation, the General Department of Security II - Ministry of Public Security has identified three people who spread these false rumors. Under these circumstances, it will be difficult to quantify the above information through financial indicators. In fact, textual data provides just as important insights as numerical data. Textual information is easier to understand and helps the reader to grasp a general perspective.
Especially for new investors with little experience in applying technical analysis for securities investment, most of them rely on textual information provided by leading online news sites about securities or daily news articles published by securities companies. Hence, text analysis is of great importance and is complementary to the analysis of financial indices and valuation models. Text Mining, an artificial intelligence technique to solve problems, can generalize the main idea in a short time and calculate the correlation between words. Sanjiv Ranjan Das (2014) has exploit large-scale text, automatically processing plain text language in digital form to extract data converted into useful quantitative or qualitative information.
The use of Text-Mining methods for stock market forecasting is highly necessary, and creative etc. However, there are only limited number of studies on the topic in Vietnam. Therefore, I conduct this research to fill the research gap and contribute to the literature as well as the decision-making process of investors on the stock market. Research objectives (i) Summarize theoretical basis related to the application of machine learning to forecast stock price fluctuations (1) Conduct literature review on domestic and foreign studies using text mining methods in stock price prediction (iii) Demonstrate that economic, business, and financial news on popular newspapers affect the price trend of the VN-Index.
(iv) Apply text mining method to forecast price fluctuations of the Vietnamese stock market through synthesizing news and VN-Index. (v) Propose improvements of Text Mining techniques to increase accuracy in forecasting the Vietnamese stock market. (vi) Create an objective and valuable source of reference for investors in making investment decisions. Scope of the study Research period: 2001 - 2021.
The scope of research: To use the text classification technique applied on Vietnamese news files in the financial and securities categories on the popular website of Vietnam. Research structure This study is structured into 4 chapters as below: Chapter 1: Theoretical basis and literature review Chapter 2: Data processing process Chapter 3: Building a test program Chapter 4: Conclusion 5. Research model Using the models: Support Vector Machine, Decision Tree, Random Forest, K-Nearest Neighbor (KNN) to forecast price volatility of Vietnam's stock market. The specific research process is as follows: The author collects text data sources, articles and news from four famous financial websites, and numerical data source is the historical price index of the VN-INDEX from Investing.com using Python's Beautiful Soup library.
After that, the study combined the text information and labeled the articles according to 3 levels: increase, decrease, unchanged, to facilitate the research in the next steps. The author removed redundant words and stop words by using Vietnamese word segmentation tool Word_tokenizer of Underthesea library - a tool with 90% accuracy rate in encoding Vietnamese sentences. The processed news documents will be included in the Feature Selection. In this step, the author used TF-IDF method to filter out 1024 characteristic words from the data set, which are the most characteristic words to help machine models learn from based on which to give classification results the most exactly.
Those data will be put into the Training program on 2 datasets with the rate of 70:30. After being trained, the author carried out Model Test to select the optimal model and the best input data set, in order to improve the research results. Removing reduntdant character. Historical (punctuation, number, ) price VN- TNDEX ee News ~ 70,000 | 1: Decrease (2001-2021) 2:No increase, no decrease Removing Stopword 3 Representation in ‘A PROCESSING Vector Space Ũ t t 1 Ũ 1 ' Train — test split 1 Ũ 1 ' 70:30 ' ! 1 ' 1 ' 4 models ' TESTING MODEL TRAINING DATA ' | Decision Tree, Random Forest, K- h |_ | Nearest Neighbor, Support Vector i t Machine 1 Ũ 1 ' 1 Ũ 1 ' ' t 1 Input data Optimized ' 1 Ũ 1 ' ' Ũ 1 ' 1 ' 1 CHAPTER 1: THEORETICAL BASIS AND LITERATURE REVIEW 1.
Stock market analysis 1. Fundamental analysis Fundamental analysis (FA) is a method of measuring a security's intrinsic value by examining related economic and financial factors. Fundamental analysts study anything that can affect the security's value, from macroeconomic factors such as the state of the economy and industry conditions to microeconomic factors like the effectiveness of the company's management.