Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Conversion of the time series values to 2-D stock bar chart images and prediction using CNN (using Keras-Tensorflow)

Notifications You must be signed in to change notification settings

omerbsezer/TimeSeries2DBarChartImageCNN

Repository files navigation

TimeSeries2DBarChartImageCNN: Financial Trading Model with Stock Bar Chart Image Time Series with Deep Convolutional Neural Networks

CNN-BI

"In this study, we developed an out-of-the-box algorithmic trading strategy which was based on identifying Buy-Sell decisions based on triggers that are generated from a trained deep CNN model using stock bar chart images. Almost all existing strategies in literature used the stock time series data directly or indirectly, however in this study we chose a different path by using the chart images directly as 2-D images without introducing any other time series data. To best of our knowledge, this is the first attempt in literature to adapt such an unconventional approach. The results indicate that the proposed model was able to produce generally consistent outcomes and was able to beat BaH strategy depending on the market conditions."

Method

image

Generated Images

image

Sample Result:

image

Phases in the algorithm:

Conversion of the time series values to 2-D stock bar chart images and prediction using CNN. Numpy, Pandas, Tensorflow and Keras libraries are used to implement algorithm.

  1. Download stock historical data from "finance.yahoo.com" (there is example files in \data directory).
  2. Run sol.py to create training and test image files.
  3. Run cnn.py with training.csv and test.csv, and create cnn_result file with prediction, price and ground-truth data.
  4. Evalute with evaluateFinancial.java

Paper Link: https://arxiv.org/pdf/1903.04610.pdf

Note: If you are using code or idea from paper, please refer to this paper.

Bibtex:

@article{sezer2019financial,
  title={Financial trading model with stock bar chart image time series with deep convolutional neural networks},
  author={Sezer, Omer Berat and Ozbayoglu, Ahmet Murat},
  journal={arXiv preprint arXiv:1903.04610},
  year={2019}
}

About

Conversion of the time series values to 2-D stock bar chart images and prediction using CNN (using Keras-Tensorflow)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published