Open-source project
Hvass-Labs/Finance-Research avatar
Hvass-Labs/Finance-Research

Finance-Research keeps portfolio research as rerunnable notebooks

Research in investment finance with Python Notebooks

1,135 stars231 forksJupyter NotebookMIT

At a glance

What is it?
Hvass-Labs' Finance-Research is a set of Python notebooks that hold the code behind five published papers on long-term investing and portfolio optimisation, plus a dozen stand-alone studies, with the reusable algorithms factored out into the separate InvestOps package. The notebooks are the argument, the package is the tooling, and the data comes from a third party service you have to supply yourself.
Who is it for?
Finance-Research suits a quant or finance student who wants to read a portfolio construction method as working code rather than as prose, and it suits a developer who wants to modify and rerun the analysis, which is the reason the author wrote it as notebooks.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 112 days ago.
What is it written in?
Mainly Jupyter Notebook, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The code is the paper

Finance-Research is described as a collection of research papers on long-term investing, portfolio optimization and similar topics, written as Python Notebooks so they can easily be modified and run again. That single design choice explains almost everything about the repository.

Most published quantitative finance work arrives as a PDF with maybe an appendix of equations. A notebook repository arrives as the whole derivation: the data you loaded, the transformation you applied, the chart you produced, the number you quoted, and the next cell that checks whether it holds. If you disagree with a modelling choice, you change it and rerun, rather than emailing the author.

The author is Magnus Erik Hvass Pedersen of Hvass-Labs, and the papers themselves are hosted separately in a Finance-Papers repository and on SSRN, with the notebooks in this repository producing the plots and statistics for them. Each paper has a PDF, a notebook and a Google Colab link, most also have a video, and the Colab link is the point of entry for most people: you can open the notebook in a browser and run it without installing anything locally.

The audience is people who want to check the work. A student who has read a summary of a portfolio construction method and wants to see it computed, a practitioner who wants to know whether the assumptions hold on their own data, and a developer who wants to reuse a forecasting or optimisation routine in their own project.

The licence is MIT, and the repository is not archived. The last push was on 2026-07-03.

Five published papers and a dozen stand-alone studies

The inventory is split into two parts, and the distinction is between work that became a paper and work that did not.

The five papers are Long-Term Stock Forecasting, Simple Portfolio Optimization That Works!, Fast Portfolio Diversification, Portfolio Group Constraints, and Does Volatility Harvesting Really Work? Each one exists as a PDF on SSRN, and most have an accompanying video, with the notebook in this repository producing the figures and statistics. The titles are the author's, and the framing of the fourth is a research question rather than a claim, which is a reasonable way to title something that tests a premise.

The stand-alone studies have a numbered naming scheme that makes the progression legible. 01 is the basic long-term stock forecasting notebook, 01B is better long-term stock forecasts, 01C is the theory behind the forecasting model, 01D is testing that model, 01E forecasts US stock indices, 01F forecasts international indices, and 01G forecasts a house price index. Then 02 compares stock indices, 03 is portfolio optimisation using signals, 04 is multi-objective portfolio optimisation, 05 forecasts the price to sales ratio, 06 forecasts sales growth, and 07 forecasts dividends.

Read as a sequence, that is a research programme. The forecasting model comes first and is examined in isolation, then applied to indices and to a non-equity asset, then the forecasts are used as inputs to portfolio construction, and then a second objective is added to the optimisation.

The papers also have a YouTube playlist with a video for each research paper, and the repository root holds the notebooks plus a Forecasting_Stock_Indices.xlsx spreadsheet and an images/ directory for the figures, which is what the notebook outputs end up in.

Installing the dependencies, which is most of the setup

There is no package to install, because the deliverable is notebooks. The setup is an environment plus the data access, and the requirements file states the environment part.

The header of requirements.txt gives the recipe for Anaconda users:

bash
conda create --name FinanceOps python=3
source activate FinanceOps
pip install -r requirements.txt

The dependency list is a full scientific Python stack: numpy for array based computing, scipy for scientific computing, pandas for time series computing, matplotlib and seaborn for plotting, sklearn for machine learning, requests for downloading from the internet, notebook and ipywidgets for the notebook environment and its widgets, statsmodels for statistical modelling, numba for just-in-time compilation, and two project-specific ones. simfin is a financial database, used to obtain the company fundamentals the analysis needs, and investops is the author's own investment tools package.

pygmo is in the list for multi-objective optimisation, which is what notebook 04 and the multi-objective parts of the portfolio work rely on, and it is a heavy dependency to pull in for someone who only wants to read the forecasting notebooks.

One inconsistency to note: the requirements file header describes itself as the package requirements for FinanceOps and links to a FinanceOps repository, while the package the README points to is called InvestOps. The environment name in the commands is FinanceOps as well. Expect to meet both names.

The data side is the part that needs your own credentials. The repository contains a data/ directory, a data.py module for data loading, and a data_keys.py module that almost certainly holds the keys and identifiers for whatever data source is used, and the simfin dependency means the raw fundamentals come from that service.

The helper modules are the reusable part

Underneath the notebooks, the repository root holds a set of ordinary Python modules, and they are where the actual implementation lives.

portfolio.py is the portfolio construction code, portfolio_utils.py the helpers around it, and portfolio_multi.py the multi-objective variant. diversify.py implements the diversification routine that the fast portfolio diversification paper is about, curve_fit.py handles curve fitting, returns.py computes returns, stats.py the statistics, recovery.py is for recovery analysis, and utils.py holds shared utilities.

That split tells you how the author works. A notebook is the narrative: load the data, call into these modules, plot the result, and discuss it. The module is the method, written once and reusable. That structure is why the repository can hold a dozen studies without duplicating code, and it is also why a developer who wants the algorithm for their own project should read the module rather than copy cells out of a notebook.

The InvestOps package is the next layer. The README describes it as containing the main results and algorithms from this research, making it very easy to use in your own Python projects. So there are three levels of reuse available: read the notebook to understand the method, import the local module to call the routine, or depend on the published package to get the maintained version. The third is the one to use in production, and it exists precisely because the first two are research material.

There is also a hosted front end. The stock valuation research has been made into a web site that the README invites anyone to try, and it notes that portfolio optimisation will be available there later. So the public, non-technical entry point to this work is currently the valuation side.

What it takes to reproduce a result

The honest limitations are worth setting out, because the notebooks are old enough that anyone running them will hit them.

First, the data. The analysis depends on the simfin financial database and on whatever the data/ directory holds, and a financial data provider's contents and history can change over time. A notebook that produced a particular number in a particular year may not reproduce exactly today, and the repository does not pin data versions in a way that would let you prove reproducibility. For research purposes that is an inconvenience; for anything that depends on the specific figures, it is a limitation you need to state explicitly.

Second, the environment. The dependencies are unpinned in the requirements file, so the environment may not match what the notebooks were written against. Expect to spend time on the environment before the analysis runs, and expect the code to need small adaptations to current library APIs.

Third, the scope. These are the results of one researcher's methods on the data available to them. The notebooks are published so the work can be checked and reused, but a result from a notebook is evidence about a method under specific assumptions, not a recommendation about a portfolio.

The upside of all this is that the repository is explicitly designed to be modified and run again, so the failure modes above are recoverable in a way they are not for a PDF. The Colab links help too, because a notebook opened there can still be edited and rerun.

The repository is not archived and the last push was on 2026-07-03, so maintenance is occasional rather than continuous, and there are no tagged releases to pin against.

Editorial conclusion

Finance-Research suits a quant or finance student who wants to read a portfolio construction method as working code rather than as prose, and it suits a developer who wants to modify and rerun the analysis, which is the reason the author wrote it as notebooks. It is the wrong choice if you want a library to call from a production system without reading the research first, because the algorithms live in a separate package and the notebooks assume a research workflow, and a poor match if you have no access to the underlying financial data, since the notebooks depend on a commercial style data feed that you must configure. Before using it, install the dependencies as documented, point the data helpers at your own credentials, and read the notebooks rather than copying a single result.

Frequently asked questions

What is in the Finance-Research repository?

It holds the Python notebooks that produce the plots and statistics for five published papers on long-term investing and portfolio optimisation, plus a dozen stand-alone studies numbered 01 through 07, along with the helper modules that implement the methods.

How do I set up the Python environment for these notebooks?

The requirements file gives the Anaconda recipe: conda create --name FinanceOps python=3, then source activate FinanceOps, then pip install -r requirements.txt. The dependencies include numpy, scipy, pandas, matplotlib, seaborn, sklearn, statsmodels, numba, pygmo, simfin and investops.

How do I use the algorithms outside the notebooks?

The main results and algorithms from the research are packaged in the separate InvestOps Python package, which the README describes as making them easy to use in your own Python projects. The repository also contains local modules such as portfolio.py, portfolio_utils.py, portfolio_multi.py and diversify.py.

Can I run these notebooks without installing anything locally?

Each paper and study has a Google Colab link in the README, so the notebooks can be opened and run in a browser. You will still need access to the underlying financial data source, which the requirements list points at through the simfin package.

Official sources

  1. Hvass-Labs/Finance-Research on GitHub
  2. Issues
  3. License: MIT
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/hvass-labs-finance-research.svg)](https://hysenlabs.com/projects/hvass-labs-finance-research)

Was this useful?