{"id":15623184,"url":"https://github.com/hvass-labs/financeops","last_synced_at":"2025-04-12T23:40:48.189Z","repository":{"id":44342838,"uuid":"141877897","full_name":"Hvass-Labs/FinanceOps","owner":"Hvass-Labs","description":"Research in investment finance with Python Notebooks","archived":false,"fork":false,"pushed_at":"2022-02-12T16:04:25.000Z","size":41275,"stargazers_count":983,"open_issues_count":0,"forks_count":224,"subscribers_count":47,"default_branch":"master","last_synced_at":"2025-04-12T23:40:14.020Z","etag":null,"topics":["finance","investing","portfolio-optimization","python","stocks"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hvass-Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-22T08:14:46.000Z","updated_at":"2025-04-12T20:37:26.000Z","dependencies_parsed_at":"2022-08-23T17:00:23.495Z","dependency_job_id":null,"html_url":"https://github.com/Hvass-Labs/FinanceOps","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hvass-Labs%2FFinanceOps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hvass-Labs%2FFinanceOps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hvass-Labs%2FFinanceOps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hvass-Labs%2FFinanceOps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hvass-Labs","download_url":"https://codeload.github.com/Hvass-Labs/FinanceOps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647253,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finance","investing","portfolio-optimization","python","stocks"],"created_at":"2024-10-03T09:56:42.195Z","updated_at":"2025-04-12T23:40:48.159Z","avatar_url":"https://github.com/Hvass-Labs.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FinanceOps\n\n[Original repository on GitHub](https://github.com/Hvass-Labs/FinanceOps)\n\nOriginal author is [Magnus Erik Hvass Pedersen](http://www.hvass-labs.org)\n\n\n## Introduction\n\nThis is a collection of research papers on long-term investing, portfolio\noptimization, etc. They are written as Python Notebooks so they can easily be\nmodified and run again.\n\n\n## Python Package\n\nThe [InvestOps](https://github.com/Hvass-Labs/InvestOps) Python package\ncontains the main results and algorithms from this research, making it\nvery easy to use in your own Python projects.\n\n\n## Papers\n\nThe following Python Notebooks produce the plots and statistics for some of my\n\"normal\" research papers which can be downloaded from\n[SSRN](http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=1993051)\nand [GitHub](https://github.com/Hvass-Labs/Finance-Papers).\n\n- Long-Term Stock Forecasting\n([PDF](https://ssrn.com/abstract=3750775))\n([Video](https://www.youtube.com/watch?v=L8OtWNCQAAs))\n([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/Paper_Long-Term_Stock_Forecasting.ipynb))\n([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/Paper_Long-Term_Stock_Forecasting.ipynb))\n\n- Simple Portfolio Optimization That Works!\n([PDF](https://ssrn.com/abstract=3942552))\n([Video](https://www.youtube.com/watch?v=5--5Ydtbu1Y))\n([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/Paper_Simple_Portfolio_Optimization.ipynb))\n([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/Paper_Simple_Portfolio_Optimization.ipynb))\n\n- Fast Portfolio Diversification\n([PDF](https://ssrn.com/abstract=4009041))\n([Video](https://www.youtube.com/watch?v=5--5Ydtbu1Y))\n([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/Paper_Fast_Portfolio_Diversification.ipynb))\n([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/Paper_Fast_Portfolio_Diversification.ipynb))\n\n- Portfolio Group Constraints\n([PDF](https://ssrn.com/abstract=4033243))\n([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/Paper_Portfolio_Group_Constraints.ipynb))\n([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/Paper_Portfolio_Group_Constraints.ipynb))\n\n- Does Volatility Harvesting Really Work?\n([PDF](https://ssrn.com/abstract=3847692))\n([Video](https://www.youtube.com/watch?v=t0AxhyQRRvM))\n([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/Paper_Volatility_Harvesting.ipynb))\n([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/Paper_Volatility_Harvesting.ipynb))\n\n\n## Other Research\n\nThe following Python Notebooks contain stand-alone research without \"normal\" papers.\n\n1. Basic Long-Term Stock Forecasting ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/01_Forecasting_Long-Term_Stock_Returns.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/01_Forecasting_Long-Term_Stock_Returns.ipynb))\n\n1-B. Better Long-Term Stock Forecasts ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/01B_Better_Long-Term_Stock_Forecasts.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/01B_Better_Long-Term_Stock_Forecasts.ipynb))\n\n1-C. Theory of Long-Term Stock Forecasting ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/01C_Theory_of_Long-Term_Stock_Forecasting.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/01C_Theory_of_Long-Term_Stock_Forecasting.ipynb))\n\n1-D. Testing the Stock Forecasting Model ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/01D_Testing_the_Stock_Forecasting_Model.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/01D_Testing_the_Stock_Forecasting_Model.ipynb))\n\n1-E. Forecasting U.S. Stock Indices ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/01E_Forecasting_US_Stock_Indices.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/01E_Forecasting_US_Stock_Indices.ipynb))\n\n1-F. Forecasting International Stock Indices ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/01F_Forecasting_Int_Stock_Indices.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/01F_Forecasting_Int_Stock_Indices.ipynb))\n\n1-G. Forecasting House Price Index ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/01G_Forecasting_House_Price_Index.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/01G_Forecasting_House_Price_Index.ipynb))\n\n2. Comparing Stock Indices ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/02_Comparing_Stock_Indices.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/02_Comparing_Stock_Indices.ipynb))\n\n3. Portfolio Optimization Using Signals ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/03_Portfolio_Optimization_Using_Signals.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/03_Portfolio_Optimization_Using_Signals.ipynb))\n\n4. Multi-Objective Portfolio Optimization ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/04_Multi-Objective_Portfolio_Optimization.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/04_Multi-Objective_Portfolio_Optimization.ipynb))\n\n5. Forecasting the P/Sales Ratio ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/05_Forecasting_PSales_Ratio.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/05_Forecasting_PSales_Ratio.ipynb))\n\n6. Forecasting Sales Growth ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/06_Forecasting_Sales_Growth.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/06_Forecasting_Sales_Growth.ipynb))\n\n7. Forecasting Dividends ([Notebook](https://github.com/Hvass-Labs/FinanceOps/blob/master/07_Forecasting_Dividends.ipynb)) ([Google Colab](https://colab.research.google.com/github/Hvass-Labs/FinanceOps/blob/master/07_Forecasting_Dividends.ipynb))\n\n\n## Videos\n\nThere is a [YouTube video](https://www.youtube.com/playlist?list=PL9Hr9sNUjfsmlHaWuVxIA0pKL1yjryR0Z) for each research paper.\n\n\n## Downloading\n\nThe Python Notebooks use source-code located in different files to allow for easy re-use\nacross multiple Notebooks. It is therefore recommended that you download the whole\nrepository from GitHub, instead of just downloading the individual Python Notebooks.\n\n\n### Git\n\nThe easiest way to download and install this is by using git from the command-line:\n\n    git clone https://github.com/Hvass-Labs/FinanceOps.git\n\nThis creates the directory `FinanceOps` and downloads all the files to it.\n\nThis also makes it easy to update the files, simply by executing this command inside that directory:\n\n    git pull\n\n\n### Zip-File\n\nYou can also [download](https://github.com/Hvass-Labs/FinanceOps/archive/master.zip)\nthe contents of the GitHub repository as a Zip-file and extract it manually.\n\n\n## Installation\n\nIf you want to run these tutorials on your own computer, then it is best\nto use a virtual environment when installing the required packages,\nso you can easily delete the environment again.\n\nThe following command creates a virtual environment named `financeops`:\n\n    virtualenv financeops\n\nOr you can use [Anaconda](https://www.anaconda.com/download) instead of a virtualenv:\n\n    conda create --name financeops python=3\n\nThen you switch to the virtual environment and install the required packages:\n\n    source activate financeops\n    pip install -r requirements.txt\n\nWhen you are done working on the project you can deactivate the virtualenv:\n\n    source deactivate\n\n\n## How To Run\n\nOnce you have installed the required Python packages in a virtual environment,\nyou run the following commands from the `FinanceOps` directory to view, edit\nand run the Notebooks:\n\n    source activate financeops\n    jupyter notebook\n\nIf you want to edit the other source-code then you may use the free version of\n[PyCharm](https://www.jetbrains.com/pycharm/).\n\n\n### Run in Google Colab\n\nIf you do not want to install anything on your own computer, then the Notebooks\ncan be viewed, edited and run entirely on the internet by using\n[Google Colab](https://colab.research.google.com).\n\nYou click the \"Google Colab\"-link next to the research papers listed above.\nYou can view the Notebook on Colab but in order to run it you need to login using\nyour Google account.\n\nThen you need to execute the following commands at the top of the Notebook,\nwhich clones FinanceOps to your work-directory on Colab, and installs all the\nrequired Python packages:\n\n    # Clone the repository from GitHub to Google Colab's temporary drive.\n    import os\n    work_dir = \"/content/FinanceOps/\"\n    if not os.path.exists(work_dir):\n        !git clone https://github.com/Hvass-Labs/FinanceOps.git\n    os.chdir(work_dir)\n\n    # Install the required Python packages.\n    !pip install -r requirements.txt\n\nNote that you will need to run this every time you login to Google Colab.\n\n\n### Run in Docker\n\nBecause many of these Notebooks and some of the Python packages also read/write\ndata on the local disk, you would need to create so-called Docker volumes to\nenable persistent data-storage on your local disk. The instructions for setting\nthis up would be complicated, and it seems much easier to run the Notebooks\nusing one of the other methods above.\n\n\n## Data Sources\n\n- Recent share-price and fundamental data from [SimFin](https://github.com/SimFin/simfin).\n- Older share-price data from [Yahoo Finance](https://finance.yahoo.com/quote/%5EGSPC/history?p=%5EGSPC).\n- Intraday share-price data from [Alpha Vantage](https://www.alphavantage.co/)\n- Financial data for some individual stocks collected manually by the author from the 10-K Forms filed with the [U.S. SEC](http://www.sec.gov/cgi-bin/browse-edgar?company=\u0026match=\u0026CIK=jnj\u0026filenum=\u0026State=\u0026Country=\u0026SIC=\u0026owner=exclude\u0026Find=Find+Companies\u0026action=getcompany).\n- Newer S\u0026P 500 data from the [S\u0026P Earnings \u0026 Estimates Report](http://www.spindices.com/documents/additional-material/sp-500-eps-est.xlsx) and older data from the research staff at S\u0026P and Compustat (some older data is approximated by their research staff).\n- Financial data for Exchange Traded Funds (ETF) from Morningstar Direct.\n- U.S. Government Bond yield for 1-year constant maturity. From the [U.S. Federal Reserve](https://www.federalreserve.gov/datadownload/Choose.aspx?rel=H15).\n- The inflation index is: All Items Consumer Price Index for All Urban Consumers (CPI-U), U.S. City Average.\n  [Data](https://beta.bls.gov/dataQuery/find?fq=survey:%5Bcu%5D\u0026s=popularity:D\u0026q=CUUR0000SA0)\n  from the [US Department of Labor, Bureau of Labor Statistics](http://www.bls.gov/cpi/data.htm).\n\n\n## License (MIT)\n\nThese Python Notebooks and source-code are published under the [MIT License](https://github.com/Hvass-Labs/FinanceOps/blob/master/LICENSE)\nwhich allows very broad use for both academic and commercial purposes.\n\nYou are very welcome to modify and use the source-code in your own project.\nPlease keep a link to the [original repository](https://github.com/Hvass-Labs/FinanceOps).\n\nThe financial data is **not** covered by the MIT license and may have limitations on commercial redistribution, etc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhvass-labs%2Ffinanceops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhvass-labs%2Ffinanceops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhvass-labs%2Ffinanceops/lists"}