  As the Chinese stock market continues to evolve and its market structure
grows increasingly complex, traditional quantitative trading methods are facing
escalating challenges. Particularly, due to policy uncertainty and the frequent
market fluctuations triggered by sudden economic events, existing models often
struggle to accurately predict market dynamics. To address these challenges,
this paper introduces Stockformer, a price-volume factor stock selection model
that integrates wavelet transformation and a multitask self-attention network,
aimed at enhancing responsiveness and predictive accuracy regarding market
instabilities. Through discrete wavelet transform, Stockformer decomposes stock
returns into high and low frequencies, meticulously capturing long-term market
trends and short-term fluctuations, including abrupt events. Moreover, the
model incorporates a Dual-Frequency Spatiotemporal Encoder and graph embedding
techniques to effectively capture complex temporal and spatial relationships
among stocks. Employing a multitask learning strategy, it simultaneously
predicts stock returns and directional trends. Experimental results show that
Stockformer outperforms existing advanced methods on multiple real stock market
datasets. In strategy backtesting, Stockformer consistently demonstrates
exceptional stability and reliability across market conditions-whether rising,
falling, or fluctuating-particularly maintaining high performance during
downturns or volatile periods, indicating a high adaptability to market
fluctuations. To foster innovation and collaboration in the financial analysis
sector, the Stockformer model's code has been open-sourced and is available on
the GitHub repository: https://github.com/Eric991005/Multitask-Stockformer.
