Mlfinpy
Mlfin.py is an advance Machine Learning toolbox for financial applications in Python.
Install / Use
/learn @baobach/MlfinpyREADME
=========================================================== Mlfin.py - Advance Machine Learning application in Finance
.. image:: https://img.shields.io/pypi/v/mlfinpy.svg :target: https://pypi.python.org/pypi/mlfinpy :alt: PyPI Version
.. image:: https://img.shields.io/pypi/pyversions/mlfinpy.svg :target: https://pypi.python.org/pypi/mlfinpy :alt: Python Versions
.. image:: https://img.shields.io/badge/Platforms-linux--64,win--64,osx--64-orange.svg?style=flat-square :target: https://pypi.python.org/pypi/mlfinpy :alt: Platforms
.. image:: https://img.shields.io/badge/license-MIT-brightgreen.svg :target: https://pypi.python.org/pypi/mlfinpy :alt: MIT License
.. image:: https://img.shields.io/github/actions/workflow/status/baobach/mlfinpy/main.yml :target: https://github.com/baobach/mlfinpy :alt: Build Status
.. image:: https://codecov.io/github/baobach/mlfinpy/coverage.svg?branch=main :target: https://codecov.io/github/baobach/mlfinpy :alt: Coverage
.. image:: https://readthedocs.org/projects/mlfinpy/badge/?version=latest :target: https://mlfinpy.readthedocs.io/en/latest/?version=latest :alt: Documentation Status
MLfin.py is an Advance Machine Learning toolbox for financial applications. The main ideas is using
proprietary works and code snippent by Dr. Marcos López de Prado to build a morden Pythonic package
that implements newest tech stacks from various libraries such as Numpy, Pandas, Numba, and Scikit-Learn.
This work inspired by the library MlFinLab <https://github.com/hudson-and-thames/mlfinlab>_ by
Hudson and Thames. Unfortunately, the library is closed-source and I believe in the power of open
source projects, it motivates me to build this package from ground up.
Leverage best practice in packaging Python library, morden documentation style and comprehensive examples, MLfin.py will be the great tool for Quant Researchers, Algorithmic Traders, and Data Scientists as well as Finance students to reproduce the complex data transformation, labeling, sampling and feature engineering techniques with ease.
Installation
Installation can then be done via pip::
pip install mlfinpy
For the sake of best practice, it is good to do this with a dependency manager. I suggest you
set yourself up with poetry <https://github.com/sdispater/poetry>_, then within a new poetry project
run:
.. code-block:: text
poetry add mlfinpy
.. note::
If any of these methods don't work, please raise an issue <https://github.com/baobach/mlfinpy/issues>_ with the packaging label on GitHub.
For developers
If you are planning on using Mlfinpy as a starting template for significant modifications, it probably makes sense to clone the repository and to just use the source code:
.. code-block:: text
git clone https://github.com/baobach/mlfinpy
Alternatively, if you still want the convenience of a global from mlfinpy import x,
you should try:
.. code-block:: text
pip install -e git+https://github.com/baobach/mlfinpy.git
Work with HFT Data
In reality, testing code snippets 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 TickData LLC_ provides
the full history of S&P500 Emini futures tick data and available for purchase.
I am not affiliated with TickData in any way but would like to recommend others to make use of their service. The full history costs $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.
.. _TickData LLC: https://www.tickdata.com/
Download Sources
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.
.. _link: https://s3-us-west-2.amazonaws.com/tick-data-s3/downloads/ES_Sample.zip .. _research repo: https://github.com/hudson-and-thames/research/tree/master/Sample-Data
Searching for free tick data can be a challenging task. The following three sources may help:
Dukascopy_. Offers free historical tick data for some futures, though you do have to register.- Most crypto exchanges offer tick data but not historical (see
Binance API_). So you'd have to run a script for a few days. Blog Post_: How and why I got 75Gb of free foreign exchange “Tick” data.
.. _Dukascopy: https://www.dukascopy.com/swiss/english/marketwatch/historical/ .. _Binance API: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md .. _Blog Post: https://towardsdatascience.com/how-and-why-i-got-75gb-of-free-foreign-exchange-tick-data-9ca78f5fa26c
Project principles and design decisions
- It should be easy to swap out individual components of each module with the user's proprietary improvements.
- Usability is everything: it is better to be self-explanatory than consistent.
- The goal is creating a framework to build a robust and functional library for machine learning applications.
- Everything that has been implemented should be tested and formatted with lattest requirements.
- Inline documentation is good: dedicated (separate) documentation is better. The two are not mutually exclusive.
- Formatting should never get in the way of good code: because of this,
I have deferred all formatting decisions to
Black <https://github.com/ambv/black>,Flake8 <https://github.com/PyCQA/flake8>, andIsort <https://github.com/PyCQA/isort>_.
Credits
This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _audreyr/cookiecutter-pypackage: https://github.com/audreyr/cookiecutter-pypackage
Related Skills
claude-opus-4-5-migration
110.9kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
351.8kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
TrendRadar
51.2k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
mcp-for-beginners
15.8kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
