MLFinLab on PyPi Index

Finally our package MLFinLab has been released on the PyPi index.

pip install mlfinlab

MLFinLab is a “living and breathing” project in the sense that it is continually enhanced with new code from the chapters in the Advanced Financial Machine Learning book. We have built this on lean principles with the goal of providing the greatest value to the quantitative community.  Currently, the package contains code from the following chapters:

Chapter 2: Financial Data structures:

The concepts espoused in this chapter are critical for the success of a quantitative program but they are also difficult and tedious because they require raw tick data and efficient implementations of the sampling techniques. We have taken special care and thought to write code that is fast and allows users with low (RAM) memory to transform large csv files (25 gigs and up) to the desired data structure.

We thank Alexandr Proskurin, a core contributor for implementing the information-driven data structures mentioned in the book, namely the imbalance and run bars. He is providing finishing touches to the ETF trick.  It will be released soon.

Chapter 3: Labeling

This section covers Triple Barrier Labeling and Meta-Labeling techniques. Initially, we had many questions regarding meta-labeling and have provided 3 notebooks in the research repository that expand on the concept.

The code in this chapter also relies on Chapter 20: Multiprocessing and Vectorization. We have added the multiprocessing engine to the package.

Current Developments

Chapter 4: Sample Weights
Alex plans to do this section as soon as he has finished the ETF trick.

Chapter 5: Fractional Differentiated Features
Ashutosh is porting over some of the code we used in our previous project.

Chapter 7: Cross Validation in finance
Wenjie Zheng is looking into this.

Chapter 10 & 17: Bet sizing & Structural Breaks
Ashutosh and Jacques will be working on this section as it forms part of our masters research project.

Meetup Group

For those of you in the London area we have created a MeetUp group to bring like minded individuals together to discuss financial machine learning and to promote research in the field. You are invited: http://meetu.ps/c/4kmlx/z1ycV/f

Installation:

For users:

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

  1. Launch the terminal and run: pip install mlfinlab
  2. Example of the code being used in notebooks can be found here: Research

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 python=3.6 anaconda accept all the requests to install.
  4. Now activate the environment with source activate .
  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
  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

Contributions and Contact:

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. As soon as we get to more than 4 maintainers we will switch over to a slack channel. If your interested in monitoring progress you can have a look at our public project board: Projects.

For now you can get hold us at: research@hudsonthames.org

Looking forward to hearing from you!

Ashutosh Singh