Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
AACalc is an asset allocation and consumption planning calculator
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Type||Name||Latest commit message||Commit time|
|Failed to load latest commit information.|
AACalc comprises a pair of asset allocation and consumption planning calculators based on scientific principles, plus a SPIA pricing calulator. AACalc Alloc uses Merton's approach. It is fast, and easy to use. AACalc Opal is a research calculator. It is complex, and computationally demanding. The SPIA pricing calculator computes actuarially fair SPIA prices using up to date real, nominal, or corporate bond yield curves obtained from the U.S. Treasury. Notable featurss of AACalc Alloc: - A balance sheet approach - asset allocation can't be performed in isolation, but must be performed by taking into account the presence and size of Social Security, Pensions, 401(k)s, and income annuities. - Future contributions - the impact of any possible future contributions is handled by entering their expected annual amount, growth rate, and volatility. - Liability matching bonds - inflation indexed zero coupon bonds with a duration matching that of anticipated retirement cash flows are used as the risk free asset. - Income annuities - income annuitiesa are a valuable tool in the retirement toolbox. This caluclator optionally recommends the purchase of inflation indexed income annuities, that is single premium immediate annuities or deferred income annuities. - Admit what we don't know - returns from the stock market are unpredictable. We generate a range of results for different plausable scenarios. Notable features of AACalc Opal: - A stochastic dynamic programming module to compute optimal asset allocation and consumption strategies assuming time-wise independent returns. - A Monte-Carlo simulator to assess strategy performance. - A variety of pre-computed strategies: age in bonds, consensus target date, fixed, fixed with guaranteed income treated as a bond, 4% rule, constant percentage, VPW, RMD, 1/life etc. - A variety of correlation preserving bootstraping and synthetic return generation options for the Monte Carlo simulator. - The ability to report the odds of portfolio failure, the time spent in the portfolio failure state, and certainty equivalent consumption metrics. - Optional handling of taxation in the Monte Carlo simulator using a variety of lot based accounting modules. - Mortality handled stochastically using mortality tables. - When computing or simulating the performance of a strategy, the ability to use consumption utility functions indicative of floor and upside consumption preferences. - In addition to the standard asset classes, the ability to handle liability mathing bonds, real annuties, and nominal annuities. - When handling 3 or more asset classes the ability to speed up performance in exchange for some loss of optimality by using mean variance optimization thanks to the Systematic Investor Toolbox. - Graphical display of the optimal strategy and its performance thanks to GNUPLOT. - An optional web based front end to the program. Demo: - See https://www.aacalc.com/ AACalc implementation: - Open source. Licensed under the GNU Affero GPL. See the file agpl-3.0.txt for details. I am experimenting with business models, and other licensing terms may be available. - Runs on Ubuntu 16.04 Linux and possibly other systems. The Opal backend should be readily portable to other *nix systems. Frontend should be readily portable to other systems running Django 1.6. - Opal backend written in Java with call outs to R and GNUPLOT. - The Opal backend is able to take advantage of multicore computers for performance. On a 20 core m4.10xlarge instance computing the optimal asset allocation takes a few seconds in the absence of annuities, or half an hour in their presence. - Web frontend written in Python using the Django framework. - Opal backend can be either run standalone, or in a server configuration talking to the frontend. - Opal backend capable of running in an autoscaling load balancing framework. - Opal backend performs minimal input sanity checking; responsibility for input sanity checking pushed on to frontend. - Opal backend uses hill climbing to avoid exhaustive search of the solution space. - Opal backend uses Shiller and a variety of other returns datasets. Opal backend and Alloc use Social Security cohort mortality and a variety of other mortality datasets. To do: - Full scale optimization rather than MVO. - Handle returns from a distribution. (Like risk_free but with a mean, standard deviation, and distribution class such as log_normal). - Possibly support sticky market parameters (current value depends on prior years value): volatily, correlations, inflation, interest rate, etc. Sticky volatility doesn't look all that promising. Ability to predict volatility on an annual basis is probably 20-40%. See a 10% gain in metrics for expected versus unexpected 200% volatility. If occurs 25% of the time, net gain would only be 0.5-1%. Suspect stock-bond correlation is always low, so little advantage except if have other asset classes. Sticky inflation might influence nominal bond returns and SPIA prices. Sticky interest rates might influence bond returns and SPIA prices. Usually probably doesn't influence bond returns much, the one exception being the present regime, in which nominal interest rates can't fall much lower, so bond returns are at best only likely to be weakly positive. - Make lm_bonds asset class responsive to changes in the real interest rate. Requires real interest rate be a dimension like investment portfolio wealth and spia payouts. - Explore implications of using prospect theory to compute the optimal strategy (treat previous consumption level as an extra "wealth" dimension); will be slow. Getting started: - It is suggested that Amazon EC2 be used for development work. A Ubuntu 18.04 t2.micro instance works fine for Alloc. A c5.xlarge instance is recommended for running Opal without annuities, or a m5.12xlarge with annuities. Opal runs on Ubuntu 16.04 and 18.04. - Obtain the sources: sudo apt-get install git-core git clone https://github.com/gordoni/aacalc.git - If might do developement work: cd aacalc git config --global user.name "<FirstName> <LastName>" git config --global user.email "<email@example.com>" - See web/README for the web Python Django based Alloc. - Optionally see opal/README for the Java based Opal.