Need help with finance_ml?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

285 Stars 119 Forks MIT License 26 Commits 2 Opened issues


Advances in Financial Machine Learning

Services available


Need anything else?

Contributors list

# 195,688
24 commits


Python implementations of Machine Learning helper functions based on a book,

Advances in Financial Machine Learning
[1], written by
Marcos Lopez de Prado


Excute the following command

python install



  • Triple Barriers Labeling
  • CUSUM sampling ```Python from financeml.labeling import getbarrierlabels, cusumfilter from financeml.stats import getdaily_vol

vol = getdailyvol(close) trgt = vol timestamps = cusumfilter(close, vol) labels = getbarrierlabels(close, timestamps, trgt, sltp=[1, 1], numdays=1, minret=0, numthreads=16) print(

Return the following pandas.Series
python 2000-01-05 -1.0 2000-01-06 1.0 2000-01-10 -1.0 2000-01-11 1.0 2000-01-12 1.0 ``` * Future Returns for Regression


Parallel computing using

library. Here is the example of applying function to each element with parallelization. ```python import pandas as pd import numpy as np

def apply_func(x): return x ** 2

def func(df, timestamps, f): df_ = df.loc[timestamps] for idx, x in df.items(): df.loc[idx] = f(x) return df_

df = pd.Series(np.random.randn(10000)) from financeml.multiprocessing import mppandas_obj

results = mppandasobj(func, pdobj=('timestamps', df.index), numthreads=24, df=df, f=apply_func) print(results.head())

0 0.449278 1 1.411846 2 0.157630 3 4.949410 4 0.601459 dtype: float64 ```

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.