Git Product home page Git Product logo

going-deeper-with-convolutional-neural-network-for-stock-market-prediction's Introduction

Going Deeper with Convolutional Neural Network for Stock Market Prediction

Repository for Going Deeper with Convolutional Neural Network for Stock Market Prediction

Introduction

Predict the stock market price will go up or not in the near future.

Data Collection

  • Using Yahoo! Finance for time series data source
  • 50 Taiwan Companies from 0050.TW index.
  • Top 10 Indonesia Stock exchange companies.

Methodology

  • Using candlestick chart for input model
  • DeepCNN
  • ResNet 50
  • VGG16
  • VGG19
  • Randomforest
  • KNN

Usage

Prepare Environment

Recommended using virtual environment

python3 -m venv .env

Running on Python3.5

pip install -U -r requirements.txt

Prepare Dataset

  • Convert OHLCV stock market data to Candlestickchart
python run_binary_preprocessing.py <ticker> <tradingdays> <windows>

example

python run_binary_preprocessing.py 2880.TW 20 50
  • Generate dataset
python generatedata.py <pathdir> <origindir> <destinationdir>

example

python generatedata.py dataset 20_50/2880.TW dataset_2880TW_20_50
  • Remove alpha channel
cd /dataset/dataset_2880TW_20_50
find . -name "*.png" -exec convert "{}" -alpha off "{}" \;

Training

  • DeepCNN
python myDeepCNN.py -i <datasetdir> -e <numberofepoch> -d <dimensionsize> -b <batchsize> -o <outputresultreport>

example

python myDeepCNN.py -i dataset/dataset_2880TW_20_50 -e 50 -d 50 -b 8 -o outputresult.txt

Performance Evaluation

  • Accuracy
  • Specitivity
  • Sensitivity
  • MCC
  • F1

Citation

@misc{1903.12258,
Author = {Rosdyana Mangir Irawan Kusuma and Trang-Thi Ho and Wei-Chun Kao and Yu-Yen Ou and Kai-Lung Hua},
Title = {Using Deep Learning Neural Networks and Candlestick Chart Representation to Predict Stock Market},
Year = {2019},
Eprint = {arXiv:1903.12258},
}

going-deeper-with-convolutional-neural-network-for-stock-market-prediction's People

Contributors

rosdyana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

going-deeper-with-convolutional-neural-network-for-stock-market-prediction's Issues

There seems to be a mistake here!

I have been developing and testing models for the financial market for some time. An accuracy of more than 90% seems impossible to me for such simple graphic samples (with little data). I replicated your model and got to 53%. By the way, the same thing was described in the "RandomForest Classifier results" issue. I began to doubt the results of this work. Can you explain these results?

fail to convert to images

running the first step python run_binary_preprocessing.py 2880.TW 20 50 only generates one sample image, the folder "0" and "1" are empty.

RandomForest Classifier results

Thanks for making this work open-source.
I have tried to replicate your results using Taiwanese datasets.
I have generated images with dimension size of 50 and a period size of 20.
I have done testing with a random forest classifier.
I have tried a different number of estimators to check the improvement of the result.
I get accuracy around 0.55 with the shared Taiwanese dataset.
I would like to know whether you have a guess about what I could be missing?
I would like to know also why there is such a big gap between my results using the exact same pipeline and the results mentioned in the paper.

tons of issues with keras2

could this please be updated to work with a somewhat recent keras version?

thanks

UserWarning: Update your Conv2D call to the Keras 2 API...

trying to use it and breaks literally every step of the way

would it be possible to get a complete example? I keep running in all kind of issues, from keras warnings, over methods not found errors, missing requirements, etc.

example:

/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/venv/bin/python /home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py -i dataset/20_50/2880.TW -e 50 -d 50 -b 8 -o outputresult.txt
2019-06-19 05:39:27.101687: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-06-19 05:39:27.126885: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2112000000 Hz
2019-06-19 05:39:27.127344: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x1c1c450 executing computations on platform Host. Devices:
2019-06-19 05:39:27.127362: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): ,
Using TensorFlow backend.
loading dataset
train size : 3751
train size : 331
/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py:55: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(32, (3, 3), activation="relu", padding="same", kernel_initializer="glorot_uniform")
number of classes : 331
border_mode='same', activation='relu')(input_layer)
WARNING:tensorflow:From /home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/venv/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py:61: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(48, (3, 3), activation="relu", padding="same", kernel_initializer="glorot_uniform")
activation='relu')(x)
WARNING:tensorflow:From /home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/venv/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py:68: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", padding="same", kernel_initializer="glorot_uniform")
activation='relu')(x)
/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py:74: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(96, (3, 3), activation="relu", padding="same", kernel_initializer="glorot_uniform")
activation='relu')(x)
/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py:84: UserWarning: Update your Dense call to the Keras 2 API: Dense(activation="relu", units=256)
x = Dense(output_dim=256, activation='relu')(x)
/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py:88: UserWarning: Update your Dense call to the Keras 2 API: Dense(activation="softmax", units=2)
x = Dense(output_dim=2, activation='softmax')(x)
Traceback (most recent call last):
File "/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py", line 195, in
main()
File "/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/myDeepCNN.py", line 137, in main
model.fit(X_train, Y_train, batch_size=batch_size, epochs=epochs)
File "/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/venv/lib/python3.7/site-packages/keras/engine/training.py", line 952, in fit
batch_size=batch_size)
File "/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/venv/lib/python3.7/site-packages/keras/engine/training.py", line 751, in _standardize_user_data
exception_prefix='input')
File "/home/wohlgemuth/workspace/Going-Deeper-with-Convolutional-Neural-Network-for-Stock-Market-Prediction/venv/lib/python3.7/site-packages/keras/engine/training_utils.py", line 128, in standardize_input_data
'with shape ' + str(data_shape))
ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (3751, 7500)

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.