Giter VIP home page Giter VIP logo

stockpredictionrnn's Introduction

GitHub license

StockPredictionRNN

High Frequency Trading Price Prediction using LSTM Recursive Neural Networks

In this project we try to use recurrent neural network with long short term memory to predict prices in high frequency stock exchange. This program implements such a solution on data from NYSE OpenBook history which allows to recreate the limit order book for any given time. Everything is described in our paper: project.pdf

Project done for course of Computational Intelligence in Business Applications at Warsaw University of Technology - Department of Mathematics and Computer Science

Data

To use this program one has to acquire data first. We need file openbookultraAA_N20130403_1_of_1 from NYSE. It can be downloaded from ftp://ftp.nyxdata.com/Historical%20Data%20Samples/TAQ%20NYSE%20OpenBook/ using FTP. Unzip it and copy to folder src/nyse-rnn.

Installation and usage

Program is written in Python 2.7 with usage of library Keras - installation instruction To install it one may need Theano installed as well as numpy, scipy, pyyaml, HDF5, h5py, cuDNN (not all are actually needed). It is useful to install also OpenBlas.

sudo pip install git+git://github.com/Theano/Theano.git
sudo pip install keras

We use numpy, scipy, matplotlib and pymongo in this project so it will be useful to have them installed.

sudo pip install numpy scipy matplotlib pymongo

To run the program first run nyse.py to create symbols and then main.py (creating folder symbols is necessary):

cd StockPredictionRNN
cd src/nyse-rnn
mkdir symbols
python nyse.py
python main.py

To save data to mongodb one has to install it first mongo install

Look into the code, it may be necessary to uncomment some lines to enable different features.

Performance

To use CUDA and OpenBlas create file ~/.theanorc and fill it with this content:

[global]
floatX = float32 
device = gpu1

[blas]
ldflags = −L/usr/local/lib −lopenblas

[nvcc]
fastmath = True

License

The MIT License (MIT)

Copyright (c) 2016 Karol Dzitkowski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

stockpredictionrnn's People

Contributors

dzitkowskik avatar tk365 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  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

stockpredictionrnn's Issues

Features vector

Create features vector in OrderBook process method with features:

  1. Time - time since last event (ask or bid)
  2. Price - price of ask or bid
  3. Mid Price - mean of highest bid and lowest ask
  4. Volume
  5. Side - ask of bid
  6. AskPriceDiff - difference in price from last ask
  7. BidPriceDiff - difference in price from last bid
  8. AvgBidPrice - average bid price in orderbook
  9. AvgAskPrice - average ask price in orderbook

CrossValidation

Create a method of using cross validation with N passes that can be used with different neural network using different features. It should return a vector of error rates or a vector of vectors of predictions of test data. Data should be split in proportion defined in parameter.

Feature Selection

Create a method of performing a feature selection with method Greedy forward selection using cross validation from #2 it should get testing data and neural network in parameters and return a list of numbers of features to use.

Performance comparison

Create a method of comparing performance of two neural networks. Use t-student metric to compare, and its pvalue to say if difference is significant. Use mean of error rates to say which one performed better. As input use a vector of error rates from cross validation ( #2 ) of two neural networks on the same data.

Early Results

Write some words about how things were implemented and show early results of our working program after implementing issues #1 #2 #3 #4 and #5

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.