diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml new file mode 100644 index 0000000..df46ad3 --- /dev/null +++ b/.github/workflows/sphinx.yml @@ -0,0 +1,13 @@ +on: [push] + +jobs: + build: + name: Sphinx Pages + runs-on: ubuntu-latest + steps: + - uses: toniher/sphinx-pages@patch-1 + id: sphinx-pages + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + create_readme: true + source_dir: docs diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d50f54e --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = content +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..b22aa58 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,56 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'Drift' +copyright = '2022, Daniel Szemerey and Mark Szulyovszky' +author = 'Daniel Szemerey, Mark Szulyovszky' + +# The full version, including alpha/beta/rc tags +release = '1.0' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.autosectionlabel' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'sphinx-env'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'furo' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..3f93a3f --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,79 @@ +.. drift documentation master file, created by + Daniel Szemerey and Mark Szulyovszky on Wed Feb 02 14:02:22 2022. + + + +Welcome to drift's documentation! +================================== + +TLDR: *Drift helps you train and make predictions on time-series data.* + +.. figure:: images/pipeline.png + :alt: Figure of Data transformation pipeline + + Pipeline of the entire process. + +Drift is an **end-to-end***, **composable*** **modelling pipeline for financial time-series prediction**. It was designed for quantitative financial predictions. + +Drift was specifically engineered not to fool the user: it uses walk-forward method for analysis and makes sure no future information is introduced. + +Drift makes it easy to use state-of-the-art methods financial ML techniques, like the triple-barrier labeling method, ensembling models and adding bet-sizing into the mix (with meta-labeling). + +Drift has two level of usage: You can simply use existing models and transformations and just provide the data and the target asset, or you can customize your own pipeline. + + + + + +Technical Explanation +================================== + +Why Drift +-------------------------------- + +Machine learning on financial time series requires a fundamentally different approach compared to standard ML domains. +The (small amount of) data is non-stationary, extremely noisy, where the patterns frequently change, and it's extremely important to not to leak out-of-sample data into the test set. + +How Drift is different +-------------------------------- + +There are very few open-source end-to-end machine learning pipelines that can be effectively used to train and evaluate ML models on financial time series. Among them are: [qlib](https://github.com/microsoft/qlib), [AlphaPy](https://github.com/ScottfreeLLC/AlphaPy). + +Drift is different to them in a couple of angles: + +- All pre-processing steps are *online (up until a certain point),* ****so they never inject lookahead bias into the mix. (this is a major issue with finML papers) +- Feature extraction and selection are an important, pre-built step in the pipeline. Garbage in, garbage out! +- Evaluation is done in a [walk-forward manner](https://en.wikipedia.org/wiki/Walk_forward_optimization). We argue that that a train/validation/test split is not adequate to evaluate an ML model's performance in a non-stationary, regime changing environment. The walk-forward methodology enables us to evaluate the model's performance on almost the whole time series. +- Training can be done in any way possible, including Combinatorial purged k-fold cross-validation. You can shuffle the past in any way you prefer, but you can never use data from the future to train the model. +- Instead of training one model, you train tons of models **over time**, that are making predictions until they become obsolete. The walk-forward training/evaluation methodology enables "online" (ever-changing) models, that adapt to the market environment. You can specify how frequently would you like to re-train the models. +- Ensemble-by-default: train multiple models, and average their predictions. Improves performance and adds a lot of robustness in a low signal-to-noise environment, like financial time series. +- Bet sizing and Meta-labeling (training a model to evaluate a lower level model's prediction for each timestamp) is a built-in feature. + +This project is inspired partially by [Marcos Lopez de Prado's Advances in Financial Machine Learning](https://www.wiley.com/en-us/Advances+in+Financial+Machine+Learning-p-9781119482086) and [The Alpha Scientist's blogposts](https://alphascientist.com/). + + +External Links +-------------------------------- + +For more information refer +`here` + + +.. py:function:: square(x) + + return the square of a function + + + + + +Contents +================================== + +.. toctree:: + :maxdepth: 2 + + setup/index + basic-usage/index + advanced-usage/index + diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..c2250b9 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,6 @@ +Sphinx +sphinx_rtd_theme +sphinx_rtd_theme_ext_color_contrast +myst_nb +sphinx-lesson +furo diff --git a/docs/source/advanced-usage/index.rst b/docs/source/advanced-usage/index.rst new file mode 100644 index 0000000..3346a36 --- /dev/null +++ b/docs/source/advanced-usage/index.rst @@ -0,0 +1,8 @@ + +Advanced Usage +========== + +.. toctree:: + :maxdepth: 2 + + installguide diff --git a/docs/source/advanced-usage/installguide.rst b/docs/source/advanced-usage/installguide.rst new file mode 100644 index 0000000..16d209a --- /dev/null +++ b/docs/source/advanced-usage/installguide.rst @@ -0,0 +1,16 @@ +Setup and Installation +====================== + +Install using pip +----------------- +This is a sub heading to install using pip + +.. code-block:: python + + pip install library + + +.. note:: + + This is a note. Add your note here + diff --git a/docs/source/basic-usage/index.rst b/docs/source/basic-usage/index.rst new file mode 100644 index 0000000..d7257af --- /dev/null +++ b/docs/source/basic-usage/index.rst @@ -0,0 +1,8 @@ + +Basic Usage +========== + +.. toctree:: + :maxdepth: 2 + + installguide \ No newline at end of file diff --git a/docs/source/basic-usage/installguide.rst b/docs/source/basic-usage/installguide.rst new file mode 100644 index 0000000..16d209a --- /dev/null +++ b/docs/source/basic-usage/installguide.rst @@ -0,0 +1,16 @@ +Setup and Installation +====================== + +Install using pip +----------------- +This is a sub heading to install using pip + +.. code-block:: python + + pip install library + + +.. note:: + + This is a note. Add your note here + diff --git a/docs/source/images/pipeline.png b/docs/source/images/pipeline.png new file mode 100644 index 0000000..b1490ef Binary files /dev/null and b/docs/source/images/pipeline.png differ diff --git a/docs/source/setup/index.rst b/docs/source/setup/index.rst new file mode 100644 index 0000000..d43f700 --- /dev/null +++ b/docs/source/setup/index.rst @@ -0,0 +1,9 @@ + +Start Here +========== + +.. toctree:: + :maxdepth: 2 + + installguide + quick_start \ No newline at end of file diff --git a/docs/source/setup/installguide.rst b/docs/source/setup/installguide.rst new file mode 100644 index 0000000..16d209a --- /dev/null +++ b/docs/source/setup/installguide.rst @@ -0,0 +1,16 @@ +Setup and Installation +====================== + +Install using pip +----------------- +This is a sub heading to install using pip + +.. code-block:: python + + pip install library + + +.. note:: + + This is a note. Add your note here + diff --git a/docs/source/setup/quick_start.rst b/docs/source/setup/quick_start.rst new file mode 100644 index 0000000..3f98ec6 --- /dev/null +++ b/docs/source/setup/quick_start.rst @@ -0,0 +1,16 @@ +Quick Start +====================== + +Install using pip +----------------- +This is a sub heading to install using pip + +.. code-block:: python + + pip install library + + +.. note:: + + This is a note. Add your note here + diff --git a/strip-action.yaml b/strip_action.yaml similarity index 79% rename from strip-action.yaml rename to strip_action.yaml index cf548fd..89ddf00 100644 --- a/strip-action.yaml +++ b/strip_action.yaml @@ -10,4 +10,4 @@ dependencies: - pip: - black - libcst -prefix: /usr/local/anaconda3/envs/strip +prefix: /usr/local/anaconda3/envs/strip \ No newline at end of file