Machine learning stock crash prediction model (Enterprise Modeling_Thesis Research)AI model for stock crash prediction

Align the granularity, open up the underlying logic of the stock crash, form a set of combinations, form a benign ecosystem of the credit rating mechanism, and restore confidence in the stock market! --New outlook for China’s stock market! By Toby! 2024.1.3

Comprehensive introduction

Stock crash refers to the large-scale selling of securities in the securities market for some reason, causing the price of the securities market to fall indefinitely, and it is unknown to what extent it will stop. This phenomenon of large-scale selling of securities is also known as a selling surge. This situation usually triggers panic selling by investors, causing stock prices to continue to fall. Stock crashes can be caused by a variety of factors, including economic recessions, political instability, financial crises, and more. Stock crashes can have a serious impact on both investors and the market, so it is necessary to pay close attention to market trends and take appropriate risk management measures.

Stock price crash risk has been a star indicator in corporate finance in recent years. Among the papers on CNKI with the theme of stock price crash risk, 8 articles have been cited more than 1,000 times, and 18 articles have been cited more than 500 times. The stock price crash risk prediction model will be very popular in the paper market.

picture

stock crash definition

A crash is usually defined as a cumulative decline of more than 20% in a single day or over several days.

For example: During the 1987 crash, the Dow Jones Industrial Average plummeted 22.6% in one day. The declines in two consecutive trading days in 1929 were 12.8% and 11.7% respectively.

Reasons for Stock Crash

There are many direct causes of stock crashes, including natural disasters and man-made disasters, which are summarized as follows:

1. A country’s macroeconomic fundamentals have seriously deteriorated, and listed companies have operational difficulties;

2. Low-cost direct financing leads to "inefficient" finance and "inefficient" economic development, which greatly promotes bubbles and causes stock prices to be seriously overvalued.

3. The listing and trading system of the stock market itself has serious flaws, which has led to the prevalence of speculation and the loss of investment value and resource allocation functions of the stock market.

4. Political, military, natural disasters and other crises have seriously affected the confidence of the securities market, and the securities market has experienced psychological panic and cannot continue to operate normally.

stock market crash record

1. The 1929 U.S. stock market crash : Also known as "Black Thursday," it was the most severe crash in the history of the U.S. stock market. The crash marked the beginning of the Great Depression, leading to a worldwide economic downturn.

2. 1987 Global Stock Market Crash : Global stock markets experienced a massive sell-off on October 19, 1987, which caused the U.S. stock market to plummet 22%. This day was known as "Black Monday."

3. The dot-com bubble burst in 2000 : Internet and technology stock prices soared in the late 1990s and early 2000, but then the bubble burst, causing a massive stock crash.

4. 2008 Financial Crisis : The financial crisis caused by the subprime mortgage crisis led to the collapse of stock markets around the world, including the Dow Jones Index and the S&P 500 Index in the United States.

5. The mysterious case of Jiawen in Hong Kong

The recent movie "Goldfinger" tells the story of the Hong Kong-listed company Jiawen Group, which went from obscurity to prosperity and then to decline and liquidation in just a few years, with its market value evaporating by more than 10 billion. The prototype of the case, Chen Songqing, started from scratch and became worth tens of billions in a few years. He ignored the law and defrauded Hong Kong people of billions, which once shook the Hong Kong economy.

picture

picture

Credit scoring system predicts stock crashes

Predicting a stock crash requires considering a variety of factors, including market sentiment, technical indicators, fundamental analysis, macroeconomic data, etc. Predictive models for stock crashes often build complex algorithmic models based on these factors to try to predict the future direction of the market. These models may include machine learning algorithms, time series analysis, risk management models, etc.

Although the credit scoring system itself is not a direct tool for predicting stock crashes, the information it provides about a company's financial health and credit risk can be used as an important factor in stock crash prediction models.

Using artificial intelligence and machine learning technology, we can predict the probability of stock crashes, thereby reducing the investment losses of institutions and retail investors.

However, it needs to be emphasized that stock market prediction is an extremely complex and uncertain task, and no model can predict a stock crash with complete accuracy.

Stock market crash risk predictors

There are many risk predictors for stock crashes, such as

NCSKEW_Cmdos [NCSKEW (comprehensive market capitalization average method)],

DUVOL_Cmdos [DUVOL (comprehensive market capitalization average method)],

CRASH_Cmdos [CRASH (comprehensive market capitalization average method)].

picture

Can we build an AI quantitative prediction model to more accurately calculate the probability of stock crash? The answer is yes.

Stock crash prediction model case

picture

Data at a glance

This project is based on real data, involving thousands of listed company stocks, covering more than ten years of historical data, and has tens of thousands of data sets, which is very high-quality data.

picture

The project data set was downloaded from multiple financial databases and accumulated over the years. It contains hundreds of listed company financial data variables, current ratio, quick ratio, cash ratio, asset-liability ratio, equity multiplier, long-term capital liability ratio, receivables Accounts to revenue ratio, accounts receivable turnover rate, inventory turnover rate, accounts payable turnover rate, working capital (capital) turnover rate, etc.

picture

Model performance

Since the prediction of the stock market is an extremely complex and uncertain task, the performance of the current business models (stock crash prediction models) on the market is not ideal, with the model AUC only about 0.6.

picture

The model (stock crash prediction model) trained by our Chongqing Future Wisdom Information Technology Consulting Service Co., Ltd. has been fitted by commercial algorithms and has an AUC of more than 0.7, which is significantly higher than the level of market peers.

picture

Our Chongqing Future Wisdom Information Technology Consulting Service Co., Ltd. uses machine learning algorithms to perform special preprocessing of data, which can greatly improve model performance. The model performance AUC can reach 0.95, which is very suitable for research by China Securities Regulatory Commission, securities companies, financial companies or graduate students and doctoral students to publish scientific research papers.

picture

As shown in the figure below, the AUC reaches more than 0.95, and the model's discrimination ability is very excellent.

picture

credit score

In the United States, a FICO score, often called a credit score, is a three-digit number used to evaluate a person's likelihood of repaying credit when getting a credit card or loan from a lender. FICO scores are also used to help determine the interest rate on any credit extended to an individual. FICO scores range from 300 to 850 (worst to best). Every year, FICO scores (Fair, Isaac and Company) are widely used by various financial institutions and organizations. It can be said to be a very important criterion for judging a person's creditworthiness. Whether it is the success of the loan or the interest rate and discounts of the loan, they are closely related to your FICO credit score. In fact, 90% of financial institutions refer to FICO scores to make decisions, which shows the importance of FICO scores.

picture

After we have established the stock crash prediction model, we can also follow suit and establish a credit score similar to FICO, as shown below.

picture

The credit score distribution diagram of the stock crash prediction model is as follows, mainly concentrated around 637 points. The credit score of the stock market is generally good. The stock with the highest credit score reaches 776 points, and the stock with the lowest credit score is only 460 points.

picture

After calculating the stock credit score and crash probability, retail investors and institutions can predict the stock crash probability, buy stocks with high credit scores, and avoid low credit scores, thereby reducing investment risks.

Variable Interpretability of Stock Crash Prediction Models

Machine learning interpretability means that the output of a machine learning model can be understood and interpreted by humans in an understandable way. This is very important for many applications, especially in scenarios that require interpretation and understanding of model decisions, such as medical diagnosis, financial risk assessment, judicial decision-making and other fields.

The explainability of machine learning models helps enhance trust: when people can understand how a model makes a prediction or decision, they are more likely to trust the model’s results.

The interpretability of machine learning models is mainly achieved through feature importance analysis and visualization techniques.

Feature importance analysis: Explain the decision-making of the model by analyzing the impact of each feature in the model on the final prediction result. Visualization technology: Present the working principle and decision-making process of the model through visualization means such as charts and images.

The figure below ranks the importance of financial variables of listed stocks to find out the variable factors that have the greatest risk of stock crash. Among them, we found that the three macro-financial indicators of year, GDP and CPI are closely related to stock crashes.

picture

Year - an overlooked factor

The most easily overlooked thing is the year. After classifying statistics, we found that the number of crash stocks from 2007 to 2021 has a trend of rising. This is not a good sign and suggests the stock is getting more volatile and volatile. Professor Lang Xianping said before that the more QFII admission funds, the stronger the stock market penetration and market control capabilities. It seems that there are many shady hands here.

picture

GDP - surprising discovery

We can provide sufficient interpretability for variables. For example, the following is the SHAP value calculation of the GDP variable.

What surprised us was that the AI ​​believed that the larger the GDP data, the higher the probability of a stock crash; and vice versa. This simply subverts our understanding. According to school textbooks, the higher the GDP, the stronger the overall national strength. At present, the promotion of local officials is also closely related to GDP. The higher the GDP, the higher the performance projects, and the higher the probability of promotion. It seems we need to rethink the problem.

picture

According to Professor Wen Tiejun's concept, GDP is just a way of playing financial capital countries and cannot reflect a country's comprehensive national strength. The higher the GDP, the higher the proportion of financial capital, other industries will shrink, and residents' consumption power will also decline. An excessively high proportion of financial capital will create a deformed economic structure, which is not conducive to the long-term development of the country.

Model deployment

picture

The model can be encapsulated into a package and uploaded to the server application.

picture

Our model can be deployed to web servers, mobile phone APPs, and tablet APPs to achieve commercial applications. Both institutions and retail investors can use the stock crash prediction model. The model also has the function of quickly predicting multiple stocks in batches, which is efficient, fast and accurate.

Model commercial application

Users use the stock crash prediction software through a web server, mobile phone APP or tablet APP. The user enters the stock name, and the software automatically outputs the stock credit score. Retail investors and institutions can buy stocks with high credit scores and avoid stocks with low credit scores, thereby reducing investment risks.

picture

For example, if the user enters the name of stock A and the software outputs a credit score of 841, then the probability of the stock crashing is very low and can be used as a basis for purchase.

picture

The user enters the name of stock B, and the software outputs a credit score of 356. The probability of the stock crashing is very high, and it is recommended not to buy this stock.

picture

In addition to outputting the stock credit score, the model can also output the probability of the stock crashing. The probability value is distributed from 0-1. The closer the probability is to 1, the higher the probability of collapse.

This concludes the introduction to the machine learning crash stock prediction model. If you are interested in this project, such as papers, patents, bank modeling, corporate modeling, corporate research needs, you can contact our company. For business inquiries, please leave a message to the author. We provide the company's formal invoices and project contracts.

Welcome to learn more knowledge about risk control scorecard modeling "Python Credit Scorecard Modeling (with code)" . We provide professional scorecard models and other knowledge to realize automated credit scoring functions, create financial risk control credit approval models, and reduce risks. .

Author Toby, article source public account: python risk control model, machine learning stock crash prediction model

Guess you like

Origin blog.csdn.net/toby001111/article/details/135424295