StockFormer: Learning Hybrid Trading Machines with Predictive Coding

StockFormer: Learning Hybrid Trading Machines with Predictive Coding

Siyu Gao, Yunbo Wang, Xiaokang Yang

Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence
Main Track. Pages 4766-4774. https://doi.org/10.24963/ijcai.2023/530

Typical RL-for-finance solutions directly optimize trading policies over the noisy market data, such as stock prices and trading volumes, without explicitly considering the future trends and correlations of different investment assets as we humans do. In this paper, we present StockFormer, a hybrid trading machine that integrates the forward modeling capabilities of predictive coding with the advantages of RL agents in policy flexibility. The predictive coding part consists of three Transformer branches with modified structures, which respectively extract effective latent states of long-/short-term future dynamics and asset relations. The RL agent adaptively fuses these states and then executes an actor-critic algorithm in the unified state space. The entire model is jointly trained by propagating the critic's gradients back to the predictive coding module. StockFormer significantly outperforms existing approaches across three publicly available financial datasets in terms of portfolio returns and Sharpe ratios.
Keywords:
Multidisciplinary Topics and Applications: MDA: Finance
Machine Learning: ML: Deep reinforcement learning