Coder Social home page Coder Social logo

bradleyboyuyang / ml-hft Goto Github PK

View Code? Open in Web Editor NEW
233.0 7.0 74.0 43.01 MB

High frequency trading (HFT) framework built for futures using machine learning and deep learning techniques

Jupyter Notebook 100.00%
high-frequency-trading machine-learning deep-learning orderbook-imbalance orderbook-tick-data futures

ml-hft's Introduction

High Frequency Trading Framework with Machine/Deep Learning

In this project, we provide a framework/pipeline for high frequency trading using machine/deep learning techniques. More advanced feature engineering (with depth trade and quote data) and models (such as pre-trained models) can be applied in this framework.

Target

  • Extract trading signals from level-II orderbook data
  • Predict orderbook dynamics using machine learning and deep learning techniques

Data

The SGX FTSE CHINA A50 INDEX Futures (新加坡交易所FTSE**A50指数期货) tick depth data are used.

Strategy Pipline

Orderbook Signals

We use limit orderbook data to develop trading signals, including Depth Ratio, Rise Ratio, and Orderbook Imbalance (OBI).

Price Series

Feature Engineering & HFT Factors Design

  • Simple average depth ratio and OBI:

  • Weighted average depth ratio, OBI, and rise ratio:

Model Fitting

  • Basic Models:

    • RandomForestClassifier
    • ExtraTreesClassifier
    • AdaBoostClassifier
    • GradientBoostingClassifier
    • Support Vector Machines
    • Other classifiers: Softmax, KNN, MLP, LSTM, etc.
  • Hyperparameters:

    • Training window: 30min
    • Test window: 10sec
    • Prediction label: 15min forward

Performance Metrics

  • Prediction accuracy:

  • Prediction Accuracy Series:

  • Cross Validation Mean Accuracy:

  • Best Model:

PnL Visualization

Improvements

Feature Engineering

Other potentially useful signals:

  • volume imbalance signal
  • trade imbalance signal
  • technical indicators of bid and ask series (RSI, MACD...)
  • WAP/WPR, weighted average price, VWAP, TWAP
  • .....

Signal generating techniques:

  • consider different weights on different level of orderbook data for a particular signal
  • consider moving average with period n (hyperparameter)
  • consider weighted average of signals, such as weighted average of trade imbalance and orderbook imbalance
  • Lasso regression, genetic programming
  • .....

Models

This project only provides a baseline. More advanced models are welcomed:

  • CNN
  • GRU/LSTM
  • XGBoost, AdaBoost, GBDT, LightGBM
  • Attention, Auto-encoder
  • TabNet
  • Pre-trained models
  • .....

Performance Metrics

The performance metrics are subject to amendment, including the PnL calculation, commission fee consideration, etc.

ml-hft's People

Contributors

bradleyboyuyang 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

ml-hft's Issues

HFT cooperation

hello,
We will set up a high-frequency trading company in New York/China, see your code is perfect, and want to further cooperate with you.
What's your Whatsapp or WeChat number?

My Whatsapp/Wechat: +8615800210448

Label Variable Traded

Hi I really appreciate the work your doing here! I am a bit confused on the way to decided to label buy and sell signals. So you said that if current bid is greater than the minimum ask for the next 15 minutes, it is a buy signal. However, I'm not sure why this is the case. If current bid is great than the minimum ask doesn't this suggest that the security has fallen in price?

Understanding Rise Ratio

I love the project. Well done! I am a High-Frequency Trader in the crypto market usign Hummingbot myself. I will do a similar project in the near future.

Could you explain in words what the rise ratio is and how this is measured. I could not figure that out via the code

Thanks!

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.