Giter VIP home page Giter VIP logo

camel2012 / stockformereric Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eric991005/stockformer

0.0 0.0 0.0 14.32 MB

This paper, StockFormer: A Swing Trading Strategy Based on STL Decomposition and Self-Attention Networks, is currently under consideration for publication in the [Neurocomputing](https://www.sciencedirect.com/journal/neurocomputing).

Python 49.05% Jupyter Notebook 50.95%

stockformereric's Introduction

StockFormer Data File Explanation and Execution Method

Overview of "StockFormer" Code

This is the code accompanying the paper titled "StockFormer: A Swing Trading Strategy Based on STL Decomposition and Self-Attention Networks," which is currently under consideration for publication in the International Journal of Forecasting. The preprint of this paper is available on SSRN. The code provides a comprehensive framework for implementing the StockFormer model, including data preparation, model training, and backtesting. You can access the preprint at: SSRN Preprint.

Original Data

Due to the large size of the original data, the author has stored it on a cloud drive for readers to use. The link to the original data is as follows: raw_data

File Description

  • data_cleaned.ipynb: Data cleaning for raw data.

  • Stockformermodel

    • The neural network architecture of Stockformer.
  • data/STOCK

    • corr_adj.npy: The correlation matrix for input data (used for generating high-dimensional vector expressions with Struc2vec; see struc2vec for the generation method).
    • corr_struc2vec_adjgat.npy: High-dimensional vectors generated by Struc2vec, ready for direct network input.
    • flow.npz: The processed real input data.
  • log/STOCK

    • logV4: Log files output by the neural network.
  • lib

    • smallStockutils.py: Preprocessing for Stockformer input data and establishment of evaluation metrics.
  • output: Folder for output result files.

  • config: Configuration files for the network.

  • cpt/STOCK

    • saved_modelV4_2: Saved trained neural network models.
  • Stockformer_train.py: The model training file.

  • backtest

    • my_us_backtest.ipynb: Code used for backtesting stock returns.
    • us_data_21-23: The dataset constructed for backtesting based on qlib.
    • baseline: The state-of-the-art (SOTA) used for comparison with the models in this study.

How to Run

Execute the following command in the terminal to run the model:

python Stockformer_train.py --config STOCKV4.conf

How to Cite

To cite the "StockFormer" paper and code in your research or publications, please use the following formats:

APA Style: Ma, B., Wang, Y., Lu, Y., Hu, T., Xu, J., & Houlihan, P. (Year). StockFormer: A Swing Trading Strategy Based on STL Decomposition and Self-Attention Networks. SSRN Electronic Journal. Advance online publication. https://doi.org/10.2139/ssrn.4648073

MLA Style: Ma, Bohan, et al. "StockFormer: A Swing Trading Strategy Based on STL Decomposition and Self-Attention Networks." SSRN Electronic Journal, SSRN Scholarly Paper ID 4648073, Social Science Research Network, Year, https://doi.org/10.2139/ssrn.4648073.

Chicago Style: Ma, Bohan, Wang Yiheng, Lu Yuchao, Hu Tianzixuan, Xu Jinling, and Houlihan Patrick. "StockFormer: A Swing Trading Strategy Based on STL Decomposition and Self-Attention Networks." SSRN Electronic Journal. Year. https://doi.org/10.2139/ssrn.4648073.

Replace "Year" with the year of publication once it becomes available. If the paper is part of a specific issue or volume, include those details as well.

stockformereric's People

Contributors

eric991005 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.