Code repository for this paper:
StockFormer: Learning Hybrid Trading Machines with Predictive Coding.
Siyu Gao, Yunbo Wang†, Xiaokang Yang
git clone https://github.com/gsyyysg/StockFormer.git
cd StockFormer
pip install -r requirements.txt
Downloaded from YahooFinance
dir: 'data/CSI/'
dir:'code/'
1)Relational state inference module training:
cd code/Transformer/script
sh train_mae.sh
2)Long-term state inference module training:
cd code/Transformer/script
sh train_pred_long.sh
- Short-term state inference module training:
cd code/Transformer/script
sh train_pred_short.sh
- Select the best model of three state inference modules from 'code/Transformer/checkpoints/' according to their performance on validation set and add them to 'code/Transformer/pretrained/'
OR directly use the model which have been pretrained in advance by us (dir:'code/Transformer/pretrained/csi/ ')
- train SAC model (three state inference module's path can be changed in train_rl.py file)
python train_rl.py
- get prediction result on test set from 'code/results/df_print/'
If you find our work helps, please cite our paper.
@inproceedings{gaostockformer,
title={StockFormer: Learning Hybrid Trading Machines with Predictive Coding},
author={Gao, Siyu and Wang, Yunbo and Yang, Xiaokang},
booktitle={IJCAI},
year={2023}
}
This codebase is based on FinRL.