Giter Site home page Giter Site logo

jackmzw / price_prediction_lob Goto Github PK

View Code? Open in Web Editor NEW
38.0 3.0 19.0 4.17 MB

Deep learning for price movement prediction using high frequency limit order data

License: MIT License

Python 100.00%
convolutional-neural-networks recurrent-neural-networks price-prediction high-frequency-trading

price_prediction_lob's Introduction

Price Trend Prediction Using Deep Learning

This software implements the Convolutional Neural Network (CNN) and Recurrent Neural Network (RNN) to predict the price movement using high frequency limit order data. For details, please refer to my report Price Trend Prediction Using Deep Learning.

Requirements

  • The program is written in Python, and uses pytorch, scikit-learn, pandas and numpy.
  • If necessary, run pip install -r requirements.txt.
  • A GPU is not necessary, but can provide a significant speed up especially for training a new model.

Usage

RNN model

This example trains a multi-layer RNN (Basic or LSTM) on a price movement prediction task.

The code is tested under Windows 10 Anaconda 3 and reproducible.

python rnn.py         # Train a two layers LSTM on asset a’s LOB data, running default epoch of 50
python rnn.py --model=RNN_TANH  # Train a two layers basic RNN model with tanh activation function
python rnn.py --symbol=b --epochs=30    # Train a two layers LSTM on asset b’s LOB data, running epoch of 30

After training, it will print out the performance measures in test set, as well as the plots of loss and kappa in both train and valid set after each epoch.

During training, if a keyboard interrupt (Ctrl-C) is received, training is stopped and the current model is evaluated against the test dataset.

The rnn.py script accepts the following arguments:

optional arguments:
  -h, --help         show this help message and exit
  --data DATA        location of the market data
  --model MODEL      type of recurrent net (RNN_TANH, RNN_RELU, LSTM, GRU)
  --symbol SYMBOL    symbol of asset (a, b)
  --nhid NHID        number of hidden units per layer
  --nlayers NLAYERS  number of layers
  --lr LR            initial learning rate
  —-decay DECAY      learning rate dacay
  --clip CLIP        gradient clipping
  --epochs EPOCHS    upper epoch limit
  --bsz BSZ          batch size
  --bptt BPTT        sequence length
  --nsample NSAMPLE  size of training set after subsample
  --dropout DROPOUT  dropout applied to layers (0 = no dropout)
  --seed SEED        random seed
  --log-interval N   report interval
  --save SAVE        path to save the final model

CNN model

Training CNN model is quiet similar to training a RNN model.

Train model

python cnn.py         # Train a CNN model on asset a’s LOB data, running default epoch of 50

The cnn.py script accepts the following arguments:

optional arguments:
  -h, --help         show this help message and exit
  --data DATA        location of the market data
  --symbol SYMBOL    symbol of asset (a, b)s
  --lr LR            initial learning rate
  —-decay DECAY      learning rate dacay
  --epochs EPOCHS    upper epoch limit
  --bsz N            batch size
  --bptt BPTT        sequence length
  --nsample NSAMPLE  size of training set after subsample
  --dropout DROPOUT  dropout applied to layers (0 = no dropout)
  --seed SEED        random seed
  --log-interval N   report interval
  --save SAVE        path to save the final model

price_prediction_lob's People

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

Watchers

 avatar  avatar  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.