VanekPetr / investment-funnel

Investment Funnel 📈 is an open-source python platform designed for an easy development and backtesting of outperforming investment strategies.
MIT License
57 stars 8 forks source link
asset-management finance investment-strategies machine-learning mathematical-optimization trading-algorithms

🎉 UPDATE - tests our new no-code Investment Funnel dashboard application 🎉

Welcome to our open-source project for developing and backtesting investment strategies.

Having been utilized by over 500 students from Asset Allocation classes at Copenhagen University and Danish Technical University, this project is also a pivotal tool for amateur/beginner quants.

The primary goal of this project is to provide a better overview of the ETF/Mutual fund market and to allow users to experiment with various investment techniques and algorithms. Ultimately, it offers a platform to backtest and refine investment strategies.

Technologies and Models

The Investment Funnel brings together various optimization models for asset allocation, machine learning (ML) methodologies for feature selection, and algorithms for scenario generation. Coupled with the backtesting framework and Dash application, it presents a comprehensive environment for the development and backtesting of investment strategies

Portfolio optimization models

  1. Conditional Value at Risk (CVaR) model - read more
  2. Mean-Variance (Markowitz) model - read more

ML models

  1. Minimum Spanning Tree (MST) model - read more
  2. Hierarchical Clustering (HCA) model - read more

Scenario generation algorithms

  1. Monte Carlo scenario simulation - read more
  2. Bootstrap scenario simulation - read more

To further enhance your knowledge on mathematical optimization in finance, we highly recommend the MOSEK Portfolio Optimization Cookbook.

How to start in 3 steps

STEP 0: Install poetry

STEP 1: create and activate python virtual environment

make install

STEP 2: run dash application

make funnel

The app is running on http://127.0.0.1:8050

Usage

Investment Funnel contains multiple portfolio optimization models, machine learning methods and algorithms located in models folder.

Furthermore, this project contains dash application for visualizing the data, output of ML methods as well as results from backtesting. You can explore the dash application by running app.py file.

Market Overview

On the first page of our Dash application, you'll find an overview of the performance of the ETF/Mutual fund market in terms of risk and returns. This can provide a clearer understanding of the data included in the project.

Moreover, you have the option to search and select one or more assets for a comparison against the entire universe of assets. For even deeper insight, you can repeat this experiment for various time periods.

AI Feature Selection

An integral part of optimal portfolio allocation involves feature selection. In this regard, we've implemented two machine learning methods, Minimum Spanning Tree and Hierarchical Clustering, to streamline the number of assets needed for the optimization model.

To gain a deeper understanding of these two ML models, you're afforded the opportunity to experiment with their configurations and visualize the outcomes in interactive graphs. This empowers you to delve into which assets were selected, and scrutinize the performance, specifically the risk and returns, of the selected assets over a given time period.

Backtesting

Backtesting is arguably the most crucial aspect of this project. It allows you to test your investment strategies on historical data and compare their performance with other models.

You have the flexibility to select your own train (out-of-sample) and test (in-sample) periods. You can choose an optimization portfolio allocation model as well as a machine learning model for feature selection - this helps optimize the number of assets for your model.

Further customization can be achieved by specifying your machine learning model's configurations and the algorithm for scenario generation. And lastly, you have the option to select the benchmark for comparison.

Once your backtest run completes, you will be presented with a comparative view of your optimal portfolio's performance against this benchmark for the test period.

This performance review will offer insights into portfolio value development, allocation to individual assets for each investment period, as well as comparisons in terms of average annual return, standard deviation, and Sharpe ratio.

Develop and test your own model

Lastly, you have the option to develop your own optimization and machine learning models for portfolio allocation or feature selection, and seamlessly integrate those into the investment funnel. By utilizing our Dash application, you can leverage the backtesting framework to visualize your model's results and conveniently compare its performance against those of existing models in this repository.

Further configuration for professionals or students

Are you intrigued by the Investment Funnel project? Do you wish to utilize it for your own research, teaching, or the development of investment strategies?

To make the best of this project, you'll likely need access to up-to-date financial data and a professional solver.

Authors of the project

Research related to Investment Funnel

Do you want to write your thesis on Investment Funnel? Please reach out and let us know.

Contributing

Thank you for considering contributing to this project! We welcome contributions from everyone. Before getting started, please take a moment to review our Contribution Guidelines.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This repository is licensed under MIT (c) 2023 GitHub, Inc.