owlplanner 2025.2.10__tar.gz → 2025.2.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. owlplanner-2025.2.14/.gitattributes +1 -0
  2. owlplanner-2025.2.14/INSTALL.md +52 -0
  3. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/PKG-INFO +32 -226
  4. owlplanner-2025.2.14/README.md +185 -0
  5. owlplanner-2025.2.14/USER_GUIDE.md +221 -0
  6. owlplanner-2025.2.14/docker/Dockerfile +30 -0
  7. owlplanner-2025.2.14/docker/README.md +69 -0
  8. owlplanner-2025.2.14/docker/docker-compose.yml +9 -0
  9. owlplanner-2025.2.14/docker/entrypoint.sh +35 -0
  10. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/owlplanner.cmd +1 -1
  11. owlplanner-2025.2.14/owlplanner.sh +10 -0
  12. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/pyproject.toml +1 -1
  13. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/plan.py +7 -7
  14. owlplanner-2025.2.14/src/owlplanner/version.py +1 -0
  15. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/About_Owl.py +3 -2
  16. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Create_Case.py +1 -1
  17. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Documentation.py +24 -38
  18. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Quick_Start.py +2 -1
  19. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Settings.py +10 -0
  20. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/requirements.txt +1 -1
  21. owlplanner-2025.2.10/INSTALL.md +0 -32
  22. owlplanner-2025.2.10/README.md +0 -379
  23. owlplanner-2025.2.10/src/owlplanner/version.py +0 -1
  24. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/.devcontainer/devcontainer.json +0 -0
  25. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/.flake8 +0 -0
  26. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/.github/workflows/github-actions-runtests.yml +0 -0
  27. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/.gitignore +0 -0
  28. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/LICENSE +0 -0
  29. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/AD-taxDef.png +0 -0
  30. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/AD-taxFree.png +0 -0
  31. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/AD-taxable.png +0 -0
  32. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/Hist_Bequest.png +0 -0
  33. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/Hist_Spending.png +0 -0
  34. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/MC-tutorial2a.png +0 -0
  35. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/MC-tutorial2b.png +0 -0
  36. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/OwlUI.png +0 -0
  37. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/allocations.png +0 -0
  38. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/owl.png +0 -0
  39. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/profile.png +0 -0
  40. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/ratesCorrelations.png +0 -0
  41. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/ratesPlot.png +0 -0
  42. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/savingsPlot.png +0 -0
  43. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/sourcesPlot.png +0 -0
  44. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/spendingPlot.png +0 -0
  45. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/taxIncomePlot.png +0 -0
  46. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/images/taxesPlot.png +0 -0
  47. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/owl.pdf +0 -0
  48. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/docs/owl.tex +0 -0
  49. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/case_jack+jill.toml +0 -0
  50. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/case_joe.toml +0 -0
  51. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/case_john+sally.toml +0 -0
  52. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/case_kim+sam-bequest.toml +0 -0
  53. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/case_kim+sam-spending.toml +0 -0
  54. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/jack+jill.xlsx +0 -0
  55. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/joe.xlsx +0 -0
  56. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/john+sally.xlsx +0 -0
  57. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/examples/template.xlsx +0 -0
  58. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/notebooks/john+sally.ipynb +0 -0
  59. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/notebooks/kim+sam.ipynb +0 -0
  60. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/notebooks/template.ipynb +0 -0
  61. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/notebooks/tutorial_1.ipynb +0 -0
  62. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/notebooks/tutorial_2.ipynb +0 -0
  63. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/notebooks/tutorial_3.ipynb +0 -0
  64. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/requirements.txt +0 -0
  65. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/__init__.py +0 -0
  66. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/abcapi.py +0 -0
  67. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/config.py +0 -0
  68. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/data/__init__.py +0 -0
  69. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/data/rates.csv +0 -0
  70. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/logging.py +0 -0
  71. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/progress.py +0 -0
  72. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/rates.py +0 -0
  73. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/tax2025.py +0 -0
  74. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/timelists.py +0 -0
  75. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/src/owlplanner/utils.py +0 -0
  76. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/test.py +0 -0
  77. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/tests/test_logger.py +0 -0
  78. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/tests/test_regressions.py +0 -0
  79. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/tests/test_repro.py +0 -0
  80. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/tests/test_toml_cases.py +0 -0
  81. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/tests/test_units.py +0 -0
  82. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Asset_Allocation.py +0 -0
  83. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Assets.py +0 -0
  84. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Fixed_Income.py +0 -0
  85. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Graphs.py +0 -0
  86. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Historical_Range.py +0 -0
  87. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Logs.py +0 -0
  88. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Monte_Carlo.py +0 -0
  89. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Optimization_Parameters.py +0 -0
  90. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Output_Files.py +0 -0
  91. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/README.md +0 -0
  92. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Rates_Selection.py +0 -0
  93. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Wages_And_Contributions.py +0 -0
  94. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/Worksheets.py +0 -0
  95. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/main.py +0 -0
  96. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/owlbridge.py +0 -0
  97. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/plots.py +0 -0
  98. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/progress.py +0 -0
  99. {owlplanner-2025.2.10 → owlplanner-2025.2.14}/ui/sskeys.py +0 -0
@@ -0,0 +1 @@
1
+ *.sh -crlf
@@ -0,0 +1,52 @@
1
+ ## Installation steps
2
+
3
+ ### To install and run a Docker image, please see these [instructions](docker/README.md).
4
+
5
+ ### Requirements
6
+ These instructions are for installing the Python source code for Owl and run it on your computer.
7
+ You will need Python and `pip` installed on your computer for that purpose.
8
+
9
+ ### Installation steps for end-users
10
+ You can install the Owl package directly from the [Python Package Index](http://pypi.org).
11
+ The following command will install the current version of owlplanner and all its dependencies:
12
+ ```shell
13
+ pip install -r ui/requirements.txt
14
+ ```
15
+
16
+ ### Installation steps for developers
17
+ These instructions are command-line instructions.
18
+ You will need the latest version of Owl from GitHub.
19
+ ```shell
20
+ git clone https://github.com/mdlacasse/Owl.git
21
+
22
+ ```
23
+ Go (`cd`) to the directory where you installed Owl.
24
+ From the top directory of the source code run:
25
+ ```shell
26
+ python -m build
27
+ pip install -e .
28
+ ```
29
+ The -e instructs Python to load the live version in the current directory tree.
30
+ ### Running the streamlit frontend
31
+ Running the Owl user interface locally from Windows:
32
+ ```shell
33
+ ./owlplanner.cmd
34
+ ```
35
+ From Linux or MacOS:
36
+ ```shell
37
+ ./owlplanner.sh
38
+ ```
39
+
40
+ ### Publishing a version (for reference only)
41
+ Run checks before commit:
42
+ ```
43
+ flake8 ui src tests
44
+ pytest
45
+ ```
46
+ Edit version number in `src/owlplanner/version.py`, `ui/requirements.txt`, and in `pyproject.toml`. Then,
47
+ ```shell
48
+ rm dist/*
49
+ python -m build
50
+ twine upload --repository [repo] dist/*
51
+ ```
52
+ where [repo] is *testpypi* or *pypi* depending on the type of release.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: owlplanner
3
- Version: 2025.2.10
3
+ Version: 2025.2.14
4
4
  Summary: Owl: Retirement planner with great wisdom
5
5
  Project-URL: HomePage, https://github.com/mdlacasse/owl
6
6
  Project-URL: Repository, https://github.com/mdlacasse/owl
@@ -710,10 +710,16 @@ Description-Content-Type: text/markdown
710
710
 
711
711
  -----
712
712
 
713
- ### TLDR
714
- Owl is a planning tool that uses a linear programming optimization algorithm to provide guidance on retirement decisions.
713
+ ### TL;DR
714
+ Owl is a planning tool that uses a linear programming optimization algorithm to provide guidance on retirement decisions. There are a few ways to run Owl.
715
715
 
716
- Go to [owlplanner.streamlit.app](https://owlplanner.streamlit.app) and explore the app to learn about its capabilities.
716
+ - Run Owl directly on the Streamlit Community Server at [owlplanner.streamlit.app](https://owlplanner.streamlit.app).
717
+
718
+ - Run locally on your computer using a Docker image.
719
+ Follow these [instructions](docker/README.md) for this option.
720
+
721
+ - Run locally on your computer using Python code and libraries.
722
+ Follow there [instructions](INSTALL.md) to install Owl from the source code and run it on your computer.
717
723
 
718
724
  -----
719
725
 
@@ -750,21 +756,21 @@ The algorithms in Owl rely on the open-source HiGHS linear programming solver. T
750
756
  detailed description of the underlying
751
757
  mathematical model can be found [here](https://raw.github.com/mdlacasse/Owl/main/docs/owl.pdf).
752
758
 
753
- While Owl can be used through Jupyter notebooks,
754
- its simple API also serves as a back-end for a Web application using Streamlit.
755
- A hosted version of the app can be found at [owlplanner.streamlit.app](https://owlplanner.streamlit.app).
756
- Alternatively, the application can also be run locally by simply running the script
757
- `owlplanner.cmd` once all the dependencies have been installed.
759
+ It is anticipated that most end users will use Owl through the graphical interface
760
+ either at [owlplanner.streamlit.app](https://owlplanner.streamlit.app)
761
+ or [installed](INSTALL.md) on their own computer.
762
+ The underlying Python package can also be used directly through Python scripts or a Jupyter Notebook
763
+ as described [here](USER_GUIDE.md).
758
764
 
759
765
  Not every retirement decision strategy can be framed as an easy-to-solve optimization problem.
760
766
  In particular, if one is interested in comparing different withdrawal strategies,
761
- [FI Calc](ficalc.app) is a more appropriate and elegant application that addresses this need.
767
+ [FI Calc](ficalc.app) is an elegant application that addresses this need.
762
768
  If, however, you also want to optimize spending, bequest, and Roth conversions, with
763
769
  an approach also considering Medicare and federal income tax over the next few years,
764
770
  then Owl is definitely a tool that can help guide your decisions.
765
771
 
766
772
  --------------------------------------------------------------------------------------
767
- ## Basic capabilities
773
+ ## Capabilities
768
774
  Owl can optimize for either maximum net spending under the constraint of a given bequest (which can be zero),
769
775
  or maximize the after-tax value of a bequest under the constraint of a desired net spending profile,
770
776
  and under the assumption of a heirs marginal tax rate.
@@ -805,16 +811,19 @@ bequest under the constraint of a desired net spending amount. Unlike discrete-e
805
811
  simulators, Owl uses an optimization algorithm for every new scenario, which results in more
806
812
  calculations being performed. As a result, the number of cases to be considered should be kept
807
813
  to a reasonable number. For a few hundred cases, a few minutes of calculations can provide very good estimates
808
- and reliable probability distributions. Optimizing each solution is more representative in the sense that optimal solutions
809
- will naturally adjust to the return scenarios being considered. This is more realistic as retirees would certainly re-evaluate
810
- their expectations under severe market drops or gains. This optimal approach provides a net benefit over event-based simulations,
814
+ and reliable probability distributions.
815
+ Optimizing each solution is more representative in the sense that optimal solutions
816
+ will naturally adjust to the return scenarios being considered.
817
+ This is more realistic as retirees would certainly re-evaluate
818
+ their expectations under severe market drops or gains.
819
+ This optimal approach provides a net benefit over event-based simulations,
811
820
  which maintain a distribution strategy either fixed, or within guardrails for capturing the
812
821
  retirees' reactions to the market.
813
822
 
814
823
  Basic input parameters are given through function calls while optional additional time series can be read from
815
824
  an Excel spreadsheet that contains future wages, contributions
816
- to savings accounts, and planned *big-ticket items* such as the purchase of a lake house, the sale of a boat,
817
- large gifts, or inheritance.
825
+ to savings accounts, and planned *big-ticket items* such as the purchase of a lake house,
826
+ the sale of a boat, large gifts, or inheritance.
818
827
 
819
828
  Three types of savings accounts are considered: taxable, tax-deferred, and tax-exempt,
820
829
  which are all tracked separately for married individuals. Asset transition to the surviving spouse
@@ -824,13 +833,12 @@ Tax status covers married filing jointly and single, depending on the number of
824
833
  Medicare and IRMAA calculations are performed through a self-consistent loop on cash flow constraints. Future
825
834
  values are simple projections of current values with the assumed inflation rates.
826
835
 
827
- See one of the notebooks for a tutorial and representative user cases.
828
-
829
836
  ### Limitations
830
837
  Owl is work in progress. At the current time:
831
838
  - Only the US federal income tax is considered (and minimized through the optimization algorithm).
832
839
  Head of household filing status has not been added but can easily be.
833
- - Required minimum distributions are calculated, but tables for spouses more than 10 years apart are not included. An error message will be generated for these cases.
840
+ - Required minimum distributions are calculated, but tables for spouses more than 10 years apart are not included.
841
+ An error message will be generated for these cases.
834
842
  - Social security rule for surviving spouse assumes that benefits were taken at full retirement age.
835
843
  - Current version has no optimization of asset allocations between individuals and/or types of savings accounts.
836
844
  If there is interest, that could be added in the future.
@@ -854,215 +862,12 @@ estate value too large for the savings assets to support, even with zero net spe
854
862
  or maximizing the bequest subject to a net spending basis that is already too large for the savings
855
863
  assets to support, even with no estate being left.
856
864
 
857
- -----------------------------------------------------------------------
858
- ## An example of Owl's functionality
859
- With about 10 lines of Python code, one can generate a full case study.
860
- Here is a typical plan with some comments.
861
- A plan starts with the names of the individuals, their birth years and life expectancies, and a name for the plan.
862
- Dollar amounts are in k\$ (i.e. thousands) and ratios in percentage.
863
- ```python
864
- import owlplanner as owl
865
- # Jack was born in 1962 and expects to live to age 89. Jill was born in 1965 and hopes to live to age 92.
866
- # Plan starts on Jan 1st of this year.
867
- plan = owl.Plan(['Jack', 'Jill'], [1962, 1965], [89, 92], 'jack & jill - tutorial', startDate='01-01')
868
- # Jack has $90.5k in a taxable investment account, $600.5k in a tax-deferred account and $70k from 2 tax-exempt accounts.
869
- # Jill has $60.2k in her taxable account, $150k in a 403b, and $40k in a Roth IRA.
870
- plan.setAccountBalances(taxable=[90.5, 60.2], taxDeferred=[600.5, 150], taxFree=[50.6 + 20, 40.8])
871
- # An Excel file contains 2 tabs (one for Jill, one for Jack) describing anticipated wages and contributions.
872
- plan.readContributions('jack+jill.xlsx')
873
- # Jack will glide an s-curve for asset allocations from a 60/40 -> 70/30 stocks/bonds portfolio.
874
- # Jill will do the same thing but is a bit more conservative from 50/50 -> 70/30 stocks/bonds portfolio.
875
- plan.setInterpolationMethod('s-curve')
876
- plan.setAllocationRatios('individual', generic=[[[60, 40, 0, 0], [70, 30, 0, 0]], [[50, 50, 0, 0], [70, 30, 0, 0]]])
877
- # Jack has no pension, but Jill will receive $10k per year at 65 yo.
878
- plan.setPension([0, 10.5], [65, 65])
879
- # Jack anticipates receiving social security of $28.4k at age 70, and Jill $19.7k at age 62. All values are in today's $.
880
- plan.setSocialSecurity([28.4, 19.7], [70, 62])
881
- # Instead of a 'flat' profile, we select a 'smile' spending profile, with 60% needs for the survivor.
882
- plan.setSpendingProfile('smile', 60)
883
- # We will reproduce the historical sequence of returns starting in year 1969.
884
- plan.setRates('historical', 1969)
885
- # Jack and Jill want to leave a bequest of $500k, and limit Roth conversions to $100k per year.
886
- # Jill's 403b plan does not support in-plan Roth conversions.
887
- # We solve for the maximum net spending profile under these constraints.
888
- plan.solve('maxSpending', options={'maxRothConversion': 100, 'bequest': 500, 'noRothConversions': 'Jill'})
889
- ```
890
- The output can be seen using the following commands that display various plots of the decision variables in time.
891
- ```python
892
- plan.showNetSpending()
893
- plan.showGrossIncome()
894
- plan.showTaxes()
895
- plan.showSources()
896
- plan.showAccounts()
897
- plan.showAssetDistribution()
898
- ...
899
- ```
900
- By default, all these plots are in nominal dollars. To get values in today's $, a call to
901
- ```python
902
- plan.setDefaultPlots('today')
903
- ```
904
- would change all graphs to report in today's dollars. Each plot can also override the default by setting the `value`
905
- parameters to either *nominal* or *today*, such as in the following example, which shows the taxable ordinary
906
- income over the duration of the plan,
907
- along with inflation-adjusted extrapolated tax brackets. Notice how the optimized income is surfing
908
- the boundaries of tax brackets.
909
- ```python
910
- plan.showGrossIncome(value='nominal')
911
- ```
912
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/taxIncomePlot.png" width="75%">
913
-
914
- The optimal spending profile is shown in the next plot (in today's dollars). Notice the drop
915
- (recall we selected 60% survivor needs) at the passing of the first spouse.
916
- ```python
917
- plan.showProfile('today')
918
- ```
919
-
920
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/spendingPlot.png" width="75%">
921
-
922
- The following plot shows the account balances in nominal value for all savings accounts owned by Jack and Jill.
923
- It was generated using
924
- ```python
925
- plan.showAccounts(value='nominal')
926
- ```
927
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/savingsPlot.png" width="75%">
928
-
929
- while this plot shows the complex cash flow from all sources, which was generated with
930
- ```python
931
- plan.showSources(value='nominal')
932
- ```
933
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/sourcesPlot.png" width="75%">
934
-
935
- For taxes, the following call will display Medicare premiums (including Part B IRMAA fees) and federal income tax
936
- ```python
937
- plan.showTaxes(value='nominal')
938
- ```
939
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/taxesPlot.png" width="75%">
940
-
941
- For the case at hand, recall that asset allocations were selected above through
942
-
943
- ```python
944
- plan.setAllocationRatios('individual', generic=[[[60, 40, 0, 0], [70, 30, 0, 0]], [[50, 50, 0, 0], [70, 30, 0, 0]]])
945
- ```
946
- gliding from a 60%/40% stocks/bonds portfolio to 70%/30% for Jack, and 50%/50% -> 70%/30% for Jill.
947
- Assets distribution in all accounts in today's $ over time can be displayed from
948
- ```python
949
- plan.showAssetDistribution(value='today')
950
- ```
951
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/AD-taxable.png" width="75%">
952
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/AD-taxDef.png" width="75%">
953
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/AD-taxFree.png" width="75%">
954
-
955
- These plots are irregular because we used historical rates from 1969. The volatility of
956
- the rates offers Roth conversion benefits which are exploited by the optimizer.
957
- The rates used can be displayed by:
958
- ```python
959
- plan.showRates()
960
- ```
961
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/ratesPlot.png" width="75%">
962
-
963
- Values between brackets <> are the average values and volatility over the selected period.
964
-
965
- For the statisticians, rates distributions and correlations between them can be shown using:
966
- ```python
967
- plan.showRatesCorrelations()
968
- ```
969
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/ratesCorrelations.png" width="75%">
970
-
971
- A short text summary of the outcome of the optimization can be displayed through using:
972
- ```python
973
- plan.summary()
974
- ```
975
- The output of the last command reports that if future rates are exactly like those observed
976
- starting from 1969 and the following years, Jack and Jill could afford an annual spending of
977
- \\$97k starting this year
978
- (with a basis of \\$88.8k - the basis multiplies the profile which can vary over the course of the plan).
979
- The summary also contains some details:
980
- ```
981
- SUMMARY ================================================================
982
- Net yearly spending basis in 2025$: $91,812
983
- Net yearly spending for year 2025: $100,448
984
- Net spending remaining in year 2025: $100,448
985
- Total net spending in 2025$: $2,809,453 ($7,757,092 nominal)
986
- Total Roth conversions in 2025$: $320,639 ($456,454 nominal)
987
- Total income tax paid on ordinary income in 2025$: $247,788 ($469,522 nominal)
988
- Total tax paid on gains and dividends in 2025$: $3,313 ($3,768 nominal)
989
- Total Medicare premiums paid in 2025$: $117,660 ($343,388 nominal)
990
- Spousal wealth transfer from Jack to Jill in year 2051 (nominal): taxable: $0 tax-def: $57,224 tax-free: $2,102,173
991
- Sum of spousal bequests to Jill in year 2051 in 2025$: $499,341 ($2,159,397 nominal)
992
- Post-tax non-spousal bequests from Jack in year 2051 (nominal): taxable: $0 tax-def: $0 tax-free: $0
993
- Sum of post-tax non-spousal bequests from Jack in year 2051 in 2025$: $0 ($0 nominal)
994
- Post-tax account values at the end of final plan year 2057 (nominal): taxable: $0 tax-def: $0 tax-free: $2,488,808
995
- Total estate value at the end of final plan year 2057 in 2025$: $500,000 ($2,488,808 nominal)
996
- Plan starting date: 01-01
997
- Cumulative inflation factor from start date to end of plan: 4.98
998
- Jack's 27-year life horizon: 2025 -> 2051
999
- Jill's 33-year life horizon: 2025 -> 2057
1000
- Plan name: jack & jill - tutorial
1001
- Number of decision variables: 996
1002
- Number of constraints: 867
1003
- Case executed on: 2025-02-04 at 22:55:03
1004
- ------------------------------------------------------------------------
1005
- ```
1006
- And an Excel workbook can be saved with all the detailed amounts over the years by using the following command:
1007
- ```python
1008
- plan.saveWorkbook(overwrite=True)
1009
- ```
1010
- For Monte Carlo simulations, the mean return rates, their volatility and covariance are specified
1011
- and used to generate random scenarios. A histogram of outcomes is generated such as this one for Jack and Jill, which was generated
1012
- by selecting *stochastic* rates and using
1013
- ```
1014
- plan.runMC('maxSpending', ...)
1015
- ```
1016
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/MC-tutorial2a.png" width="75%">
1017
-
1018
- Similarly, the next one was generated using
1019
- ```
1020
- plan.runMC('maxBequest', ...)
1021
- ```
1022
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/MC-tutorial2b.png" width="75%">
1023
-
1024
-
1025
- See tutorial notebooks [1](https://github.com/mdlacasse/Owl/blob/main/notebooks/tutorial_1.ipynb),
1026
- [2](https://github.com/mdlacasse/Owl/blob/main/notebooks/tutorial_2.ipynb), and
1027
- [3](https://github.com/mdlacasse/Owl/blob/main/notebooks/tutorial_3.ipynb) for more info.
1028
-
1029
-
1030
865
  ---------------------------------------------------------------
1031
- ## Requirements
1032
-
1033
- If you have Python already installed on your computer, Owl can be installed as a package using the following commands:
1034
- ```shell
1035
- python -m build
1036
- pip install .
1037
- ```
1038
- These commands need to run from the Owl directory where you downloaded Owl from GitHub either through git or a zip file.
1039
- Pip will install all the required dependencies.
1040
-
1041
- Owl relies on common Python modules such as NumPy, Pandas, SciPy, matplotlib, and Seaborn.
1042
- The user front-end was built on Streamlit.
1043
- Package `odfpy` might be required if one read files created by LibreOffice. Again, these dependencies
1044
- will be installed by pip.
1045
-
1046
- The simplest way to get started with Owl is to use the `streamlit` browser-based user interface
1047
- that is started by the `owlplanner.cmd` script, which will start a user interface on your own browser.
1048
- Here is a screenshot of one of the multiple tabs of the interface:
1049
-
1050
- <img src="https://raw.github.com/mdlacasse/Owl/main/docs/images/OwlUI.png" width="100%">
1051
-
1052
- Alternatively, one can prefer using Owl from Jupyter notebooks. For that purpose, the `examples` directory
1053
- contains many files as a tutorial. The Jupyter Notebook interface is a browser-based application for authoring documents that combines live-code with narrative text, equations and visualizations.
1054
- Jupyter will run in your default web browser, from your computer to your browser, and therefore no data is ever transferred on the Internet
1055
- (your computer, i.e., `localhost`, is the server).
1056
-
1057
- For simulating your own realizations, use the files beginning with the word *template*.
1058
- Make a copy and rename them with your own names while keeping the same extension.
1059
- Then you'll be able to personalize a case with your own numbers and start experimenting with Owl.
1060
- Notebooks with detailed explanations can be found in
1061
- [tutorial_1](https://github.com/mdlacasse/Owl/blob/main/examples/tutorial_1.ipynb),
1062
- [tutorial_2](https://github.com/mdlacasse/Owl/blob/main/examples/tutorial_1.ipynb), and
1063
- [tutorial_3](https://github.com/mdlacasse/Owl/blob/main/examples/tutorial_2.ipynb).
866
+ ## Documentation
1064
867
 
1065
- Finally, you will also need the capability to read and edit Excel files. One can have an Excel license, or use the LibreOffice free alternative. You can also use Google docs.
868
+ - Documentation for the app user interface is available from the interface itself.
869
+ - Installation guide and software requirements can be found [here](INSTALL.md).
870
+ - User guide for the underlying library to be used in a Jupyter notebook can be found [here](USER_GUIDE.md).
1066
871
 
1067
872
  ---------------------------------------------------------------------
1068
873
 
@@ -1071,6 +876,7 @@ Finally, you will also need the capability to read and edit Excel files. One can
1071
876
  - Image from [freepik](https://freepik.com)
1072
877
  - Optimization solver from [HiGHS](https://highs.dev)
1073
878
  - Streamlit Community Cloud [Streamlit](https://streamlit.io)
879
+ - Other contributors: Josh (noimjosh@gmail.com) for Docker image code
1074
880
 
1075
881
  ---------------------------------------------------------------------
1076
882
 
@@ -0,0 +1,185 @@
1
+
2
+ # Owl
3
+
4
+ ## A retirement exploration tool based on linear programming
5
+
6
+ <img align=right src="https://raw.github.com/mdlacasse/Owl/main/docs/images/owl.png" width="250">
7
+
8
+ -----
9
+
10
+ ### TL;DR
11
+ Owl is a planning tool that uses a linear programming optimization algorithm to provide guidance on retirement decisions. There are a few ways to run Owl.
12
+
13
+ - Run Owl directly on the Streamlit Community Server at [owlplanner.streamlit.app](https://owlplanner.streamlit.app).
14
+
15
+ - Run locally on your computer using a Docker image.
16
+ Follow these [instructions](docker/README.md) for this option.
17
+
18
+ - Run locally on your computer using Python code and libraries.
19
+ Follow there [instructions](INSTALL.md) to install Owl from the source code and run it on your computer.
20
+
21
+ -----
22
+
23
+ This package is a retirement modeling framework for exploring the sensitivity of retirement financial decisions.
24
+ Strictly speaking, it is not a planning tool, but more an environment for exploring *what if* scenarios.
25
+ It provides different realizations of a financial strategy through the rigorous
26
+ mathematical optimization of relevant decision variables. Two major objective goals can be set: either
27
+ maximize net spending, or after-tax bequest under various constraints.
28
+ Look at *Basic capabilities* below for more detail.
29
+
30
+ One can certainly have a savings plan, but due to the volatility of financial investments,
31
+ it is impossible to have a certain asset earnings plan. This does not mean one cannot make decisions.
32
+ These decisions need to be guided with an understanding of the sensitivity of the parameters.
33
+ This is exactly where this tool fits it. Given your savings capabilities and spending desires,
34
+ it can generate different future realizations of
35
+ your strategy under different market assumptions, helping to better understand your financial situation.
36
+
37
+ Disclaimers: I am not a financial planner. You make your own decisions.
38
+ This program comes with no guarantee. Use at your own risk.
39
+
40
+ More disclaimers: While some output of the code has been verified with other approaches,
41
+ this code is still under development and I cannot guarantee the accuracy of the results.
42
+ Use at your own risk.
43
+
44
+ -------------------------------------------------------------------------------------
45
+ ## Purpose and vision
46
+ The goal of Owl is to create a free and open-source ecosystem that has cutting-edge optimization capabilities,
47
+ allowing for the next generation of Python-literate retirees to experiment with their own financial future
48
+ while providing a codebase where they can learn and contribute. There are and were
49
+ good retirement optimizers in the recent past, but the vast majority of them are either proprietary platforms
50
+ collecting your data, or academic papers that share the results without really sharing the details of
51
+ the underlying mathematical models.
52
+ The algorithms in Owl rely on the open-source HiGHS linear programming solver. The complete formulation and
53
+ detailed description of the underlying
54
+ mathematical model can be found [here](https://raw.github.com/mdlacasse/Owl/main/docs/owl.pdf).
55
+
56
+ It is anticipated that most end users will use Owl through the graphical interface
57
+ either at [owlplanner.streamlit.app](https://owlplanner.streamlit.app)
58
+ or [installed](INSTALL.md) on their own computer.
59
+ The underlying Python package can also be used directly through Python scripts or a Jupyter Notebook
60
+ as described [here](USER_GUIDE.md).
61
+
62
+ Not every retirement decision strategy can be framed as an easy-to-solve optimization problem.
63
+ In particular, if one is interested in comparing different withdrawal strategies,
64
+ [FI Calc](ficalc.app) is an elegant application that addresses this need.
65
+ If, however, you also want to optimize spending, bequest, and Roth conversions, with
66
+ an approach also considering Medicare and federal income tax over the next few years,
67
+ then Owl is definitely a tool that can help guide your decisions.
68
+
69
+ --------------------------------------------------------------------------------------
70
+ ## Capabilities
71
+ Owl can optimize for either maximum net spending under the constraint of a given bequest (which can be zero),
72
+ or maximize the after-tax value of a bequest under the constraint of a desired net spending profile,
73
+ and under the assumption of a heirs marginal tax rate.
74
+ Roth conversions are also considered, subject to an optional maximum conversion amount,
75
+ and optimized to suit the goals of the selected objective function.
76
+ All calculations are indexed for inflation, which is either provided as a fixed rate,
77
+ or through historical values, as are all other rates used for the calculations.
78
+ These rates can be used for backtesting different scenarios by choosing
79
+ *historical* rates, or by choosing *historical average* rates over a historical year range,
80
+ or what I coined "*histochastic*" rates which are
81
+ generated using the statistical distribution of observed historical rates.
82
+
83
+ Portfolios available for experimenting include assets from the S&P 500, Corporate Bonds Baa, Treasury 10-y Notes,
84
+ and cash assets assumed to just follow inflation which is represented by the Consumer Price Index.
85
+ Other asset classes can easily be added, but would add complexity while only providing diminishing insights.
86
+ Historical data used are from
87
+ [Aswath Damodaran](https://pages.stern.nyu.edu/~adamodar/) at the Stern School of Business.
88
+ Asset allocations are selected for the duration of the plan, and these can glide linearly
89
+ or along a configurable s-curve from now to the last year of the plan.
90
+
91
+ Spending profiles are adjusted for inflation, and so are all other indexable quantities. Proflies can be
92
+ flat or follow a *smile* curve which is also adjustable through two simple parameters.
93
+
94
+ Available rates are from 1928 to last year and can be used to test historical performance.
95
+ Fixed rates can also be provided, as well as *histochastic* rates, which are generated using
96
+ the statistical characteristics (means and covariance matrix) of
97
+ a selected historical year range. Pure *stochastic* rates can also be generated
98
+ if the user provides means, volatility (expressed as standard deviation), and optionally
99
+ the correlations between the different assets return rates provided as a matrix, or a list of
100
+ the off-diagonal elements (see the notebook tutorial for details).
101
+ Average rates calculated over a historical data period can also be chosen.
102
+
103
+ Monte Carlo simulations capabilities are included and provide a probability of success and a histogram of
104
+ outcomes. These simulations can be used for either determining the probability distribution of the
105
+ maximum net spending amount under
106
+ the constraint of a desired bequest, or the probability distribution of the maximum
107
+ bequest under the constraint of a desired net spending amount. Unlike discrete-event
108
+ simulators, Owl uses an optimization algorithm for every new scenario, which results in more
109
+ calculations being performed. As a result, the number of cases to be considered should be kept
110
+ to a reasonable number. For a few hundred cases, a few minutes of calculations can provide very good estimates
111
+ and reliable probability distributions.
112
+ Optimizing each solution is more representative in the sense that optimal solutions
113
+ will naturally adjust to the return scenarios being considered.
114
+ This is more realistic as retirees would certainly re-evaluate
115
+ their expectations under severe market drops or gains.
116
+ This optimal approach provides a net benefit over event-based simulations,
117
+ which maintain a distribution strategy either fixed, or within guardrails for capturing the
118
+ retirees' reactions to the market.
119
+
120
+ Basic input parameters are given through function calls while optional additional time series can be read from
121
+ an Excel spreadsheet that contains future wages, contributions
122
+ to savings accounts, and planned *big-ticket items* such as the purchase of a lake house,
123
+ the sale of a boat, large gifts, or inheritance.
124
+
125
+ Three types of savings accounts are considered: taxable, tax-deferred, and tax-exempt,
126
+ which are all tracked separately for married individuals. Asset transition to the surviving spouse
127
+ is done according to beneficiary fractions for each account type.
128
+ Tax status covers married filing jointly and single, depending on the number of individuals reported.
129
+
130
+ Medicare and IRMAA calculations are performed through a self-consistent loop on cash flow constraints. Future
131
+ values are simple projections of current values with the assumed inflation rates.
132
+
133
+ ### Limitations
134
+ Owl is work in progress. At the current time:
135
+ - Only the US federal income tax is considered (and minimized through the optimization algorithm).
136
+ Head of household filing status has not been added but can easily be.
137
+ - Required minimum distributions are calculated, but tables for spouses more than 10 years apart are not included.
138
+ An error message will be generated for these cases.
139
+ - Social security rule for surviving spouse assumes that benefits were taken at full retirement age.
140
+ - Current version has no optimization of asset allocations between individuals and/or types of savings accounts.
141
+ If there is interest, that could be added in the future.
142
+ - In the current implementation, social securiy is always taxed at 85%.
143
+ - Medicare calculations are done through a self-consistent loop.
144
+ This means that the Medicare premiums are calculated after an initial solution is generated,
145
+ and then a new solution is re-generated with these premiums as a constraint.
146
+ In some situations, when the income (MAGI) is near an IRMAA bracket, oscillatory solutions can arise.
147
+ Owl will detect these cases and inform the user.
148
+ While the solutions generated are very close to one another, Owl will pick the smallest one
149
+ for being conservative.
150
+ - Part D is not included in the IRMAA calculations. Being considerably more, only Part B is taken into account.
151
+ - Future tax brackets are pure speculations derived from the little we know now and projected to the next 30 years. Your guesses are as good as mine.
152
+ Having a knob to adjust future rates might be an interesting feature to add for measuring the impact on Roth conversions.
153
+
154
+ The solution from an optimization algorithm has only two states: feasible and infeasible.
155
+ Therefore, unlike event-driven simulators that can tell you that your distribution strategy runs
156
+ out of money in year 20, an optimization-based solver can only tell you that a solution does or does not
157
+ exist for the plan being considered. Examples of infeasible solutions include requesting a bequeathed
158
+ estate value too large for the savings assets to support, even with zero net spending basis,
159
+ or maximizing the bequest subject to a net spending basis that is already too large for the savings
160
+ assets to support, even with no estate being left.
161
+
162
+ ---------------------------------------------------------------
163
+ ## Documentation
164
+
165
+ - Documentation for the app user interface is available from the interface itself.
166
+ - Installation guide and software requirements can be found [here](INSTALL.md).
167
+ - User guide for the underlying library to be used in a Jupyter notebook can be found [here](USER_GUIDE.md).
168
+
169
+ ---------------------------------------------------------------------
170
+
171
+ ## Credits
172
+ - Historical rates from [Aswath Damodaran](https://pages.stern.nyu.edu/~adamodar/)
173
+ - Image from [freepik](https://freepik.com)
174
+ - Optimization solver from [HiGHS](https://highs.dev)
175
+ - Streamlit Community Cloud [Streamlit](https://streamlit.io)
176
+ - Other contributors: Josh (noimjosh@gmail.com) for Docker image code
177
+
178
+ ---------------------------------------------------------------------
179
+
180
+ Copyright &copy; 2024 - Martin-D. Lacasse
181
+
182
+ Disclaimers: I am not a financial planner. You make your own decisions. This program comes with no guarantee. Use at your own risk.
183
+
184
+ --------------------------------------------------------
185
+