Code Monkey home page Code Monkey logo

translob's Introduction

Code repository for TransLOB

This is the repository for the paper Transformers for Limit Order Books which uses a CNN for feature extraction followed by a Transformer to predict future price movements from limit order book data.

Paper :

  • TransLOB.pdf.

Python files :

  • LobFeatures.py causal convolutional function.
  • LobAttention.py multi-head self-attention function.
  • LobPosition.py positional encodings.
  • LobTransformer.py transformer function.

This is research code and some assembly may be required.

FI-2010 dataset

The FI-2010 dataset is made up of 10 days of 5 stocks from the Helsinki Stock Exchange, operated by Nasdaq Nordic, consisting of 10 orders on each side of the LOB. Event types can be executions, order submissions, and order cancellations and are non-uniform in time. We restrict to normal trading hours (no auction).

There are 149 rows in each file : 40 LOB data points, 104 hand-crafted features and 5 prediction horizons (k=10, 20, 30, 50, 100). Each column represents an event snapshot. Data is normalized based on the prior day mean and standard deviation and is stored consecutively for each of the 5 stocks.

The training labels for prediction are as follows. Let a = 0.002. For percentage changes x >= 0.002, label 1.0 is used. For percentage changes -a < x < a, label 2.0 is used. For percentage changes x <= -a, label 3.0 is used.

Attention visualization

Convolutional output with position encoding.

Attention distributions in head 1 in the first transformer block.

Attention distributions in head 2 in the first transformer block.

Attention distributions in head 3 of the first transformer block.

translob's People

Contributors

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