Skip to content

Package based on the work of Dr Marcos Lopez de Prado regarding his research with respect to Advances in Financial Machine Learning

License

Notifications You must be signed in to change notification settings

captholley/mlfinlab

 
 


Machine Learning Financial Laboratory (mlfinlab)

Build Status codecov pylint Score License: BSD3

Documentation Status PyPi Downloads Python

MLFinLab is an open source package based on the research of Dr Marcos Lopez de Prado in his new book Advances in Financial Machine Learning. This implementation started out as a spring board for a research project in the Masters in Financial Engineering programme at WorldQuant University and has grown into a mini research group called Hudson and Thames Quantitative Research (not affiliated with the university).

The following is the online documentation for the package: read-the-docs.

Sponsors and Donating


A special thank you to our sponsors! It is because of your contributions that we are able to continue the development of academic research for open source. If you would like to become a sponsor and help support our research, please sign up on Patreon.

Platinum Sponsor:

Gold Sponsors:

Supporter Sponsors:

Barriers to Entry

As most of you know, getting through the first 3 chapters of the book is challenging as it relies on HFT data to create the new financial data structures. Sourcing the HFT data is very difficult and thus we have resorted to purchasing the full history of S&P500 Emini futures tick data from TickData LLC.

We are not affiliated with TickData in any way but would like to recommend others to make use of their service. The full history cost us about $750 and is worth every penny. They have really done a great job at cleaning the data and providing it in a user friendly manner.

Sample Data

TickData does offer about 20 days worth of raw tick data which can be sourced from their website link.

For those of you interested in working with a two years of sample tick, volume, and dollar bars, it is provided for in the research repo..

You should be able to work on a few implementations of the code with this set.



Getting Started

Recommended versions:

  • Anaconda 3
  • Python 3.6

Installation for users

The package can be installed from the PyPi index via the console:

  1. Launch the terminal and run: pip install mlfinlab

Installation for developers

Clone the package repo to your local machine then follow the steps below.

Installation on Mac OS X and Ubuntu Linux

  1. Make sure you install the latest version of the Anaconda 3 distribution. To do this you can follow the install and update instructions found on this link: https://www.anaconda.com/download/#mac
  2. Launch a terminal
  3. Create a New Conda Environment. From terminal: conda create -n <env name> python=3.6 anaconda accept all the requests to install.
  4. Now activate the environment with source activate <env name>.
  5. From Terminal: go to the directory where you have saved the file, example: cd Desktop/mlfinlab/.
  6. Install Python requirements, by running the command: pip install -r requirements.txt

Installation on Windows

  1. Download and install the latest version of Anaconda 3
  2. Launch Anaconda Navigator
  3. Click Environments, choose an environment name, select Python 3.6, and click Create
  4. Click Home, browse to your new environment, and click Install under Jupyter Notebook
  5. Launch Anaconda Prompt and activate the environment: conda activate <env name>
  6. From Anaconda Prompt: go to the directory where you have saved the file, example: cd Desktop/mlfinlab/.
  7. Install Python requirements, by running the command: pip install -r requirements.txt

How To Run Checks Locally

On your local machine open the terminal and cd into the working dir.

  1. Code style checks: ./pylint
  2. Unit tests: python -m unittest discover
  3. Code coverage: bash coverage

Built With

  • Github - Development platform and repo
  • Travis-CI - Continuous integration, test and deploy

Progress

Part 1: Data Analysis

  • Purchased high quality raw tick data.
  • Email us if you would like a sample of the standard bars.
  • Done Chapter 2: Data Structures
  • Done Chapter 3: Labeling
  • Done Chapter 4: Sample Weights
  • Done Chapter 5: Fractional Differentiation

Part 2: Modelling

  • Done Chapter 6: Ensemble Methods (Sequential Bootstrap Ensemble)
  • Done Chapter 7: Cross-Validation
  • Done Chapter 8: Feature Importance

Part 3: Backtesting

  • Done Chapter 10: Bet Sizing
  • Done Chapter 16: Asset Allocation

Part 4: Useful Financial Features

  • Done Chapter 17: Structural Breaks
  • Done Chapter 18: Entropy Features
  • Done Chapter 19: Microstructural Features

Additional

  • Done Optimal Number of Clusters (ONC) Algorithm.

Additional Research Repo

BlackArbsCEO has a great repo based on de Prado's research. It covers many of the questions at the back of every chapter and was the first source on Github to do so. It has also been a good source of inspiration for our research.

Contact us

At the moment the project is still rather small and thus I would recommend getting in touch with us over email so that we can further discuss the areas of contribution that interest you the most. We have a slack channel where we all communicate.

For now you can get hold us at: [email protected]

Looking forward to hearing from you!

License

This project is licensed under the 3-Clause BSD License - see the LICENSE.txt file for details.

About

Package based on the work of Dr Marcos Lopez de Prado regarding his research with respect to Advances in Financial Machine Learning

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%