Machine learning-driven factor fitting model for stock data and its future trend prediction

Binghui WangAdvances 2024 · DOI · OpenAlex

Abstract

Predicting stock market trends remains a significant challenge in quantitative finance due to the complex, non-linear relationships between financial variables. This paper presents a machine learning-driven factor fitting model applied to the Chinese A-share market. By extracting 16 corporate characteristic factors and employing a sliding window backtesting approach, we compare the performance of seven machine learning algorithms. Our findings demonstrate that non-linear ensemble models, specifically Gradient Boosting Decision Trees (GBDT), achieve superior predictive accuracy and returns compared to traditional linear regression models and the CSI 300 index benchmark. Despite high annualized returns, the models exhibit significant volatility, highlighting the inherent trade-offs in aggressive quantitative strategies.

Introduction

The stock market is a chaotic system influenced by a myriad of interacting variables, ranging from macroeconomic indicators to individual company financials and investor sentiment. Traditional quantitative analysis has long relied on linear multi-factor models to predict returns. However, these models often struggle to capture the intricate, non-linear dependencies present in real-world financial data. This research addresses this limitation by applying advanced machine learning (ML) techniques to factor-based stock selection, aiming to automate the recognition of hidden patterns and enhance portfolio performance.

Methodology

The core of the proposed strategy is a factor fitting model designed to map corporate characteristics to future stock returns.

Feature Engineering and Workflow

The study utilizes 16 anomaly factors categorized into seven groups: volatility, growth, momentum, size, value, liquidity, and profit. These factors serve as the input features for the ML models. The overall workflow involves data collection, cleaning, standardization, and feature selection before model training and evaluation.

Overview of the machine learning-driven quantitative stock selection workflow

Backtesting Strategy

To ensure the model adapts to changing market conditions, a "sliding window" approach is implemented. Models are trained on a rolling 8-year window of historical data to predict the following month's returns. For instance, data from January 2012 to November 2020 is used to predict returns for December 2020, after which the window shifts forward by one month.

The sliding window method for training and prediction

Portfolio Construction

Based on the predicted returns, a cross-sectional long-short portfolio is constructed. The strategy involves going "long" on the top 10% of stocks with the highest expected returns and "short" on the bottom 10%. The portfolio is rebalanced monthly.

Experimental Setup

The research utilizes historical trading and financial data from the Chinese A-share market, sourced from the CSMAR database, covering the period from January 2012 to December 2022. The stock pool is filtered to include only normally traded securities (listed for >12 months, no risk warnings). The CSI 300 Index serves as the primary benchmark for performance comparison. Seven algorithms were evaluated: Linear Regression, Decision Trees, Random Forests, Ridge Regression, Lasso Regression, GBDT, and XGBoost.

Results and Discussion

The experimental results underscore the superiority of non-linear models in the context of stock return prediction.

Model Performance Comparison

The GBDT model emerged as the top performer, achieving an annualized return of 46.97% and a Sharpe ratio of 1.07. Random Forest followed with a 36.93% return. In contrast, the CSI 300 index yielded only 6.09% annualized returns. Linear models performed significantly worse, with Lasso regression achieving only a 4.7% return, failing even to beat the market benchmark.

Model Annualized Return Sharpe Ratio Max Drawdown
GBDT 46.97% 1.07 -50.85%
Random Forest 36.93% 0.94 -65.03%
Linear Regression 12.85% 0.52 N/A
CSI 300 (Baseline) 6.09% 0.19 -40.56%
Lasso Regression 4.70% 0.11 N/A

Key Insights

  1. Non-linearity is Essential: The performance gap between tree-based ensembles and linear models confirms that the relationship between financial factors and returns is non-linear.
  2. Predictive Power of Liquidity: Feature importance analysis revealed that liquidity factors, such as turnover rate and trading volume, are strong predictors of cross-sectional returns in the A-share market.
  3. Risk-Return Trade-off: While ML models offer high returns, they are accompanied by severe maximum drawdowns (e.g., -50.85% for GBDT). This volatility may be prohibitive for risk-averse investors.

Conclusion

This study demonstrates that machine learning, particularly ensemble methods like GBDT, can significantly enhance quantitative stock selection by capturing non-linear factor relationships. However, the high volatility and significant drawdowns observed suggest that real-world application requires the integration of robust risk-management constraints. Future research should also consider the impact of transaction costs and test the model's generalizability across different global markets.

Summary updated

BibTeX
@inproceedings{wang2024machine,
  author = {Binghui Wang},
  title = {{Machine learning-driven factor fitting model for stock data and its future trend prediction}},
  booktitle = {Advances},
  year = {2024},
  doi = {10.2991/978-2-38476-257-6\_45},
}
Figure