{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a8088571-8fd2-4548-9263-bcec0d2a6edf",
   "metadata": {
    "panel-layout": {
     "height": 50.796875,
     "visible": true,
     "width": 100
    }
   },
   "source": [
    "## John and Sally (a case from Eric Sajdak)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5cb2c2a1-6f77-41bf-a22d-42863c756eeb",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.insert(0, \"../src\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "795d0d10-e364-46e0-9707-1fc5afd8bdfb",
   "metadata": {
    "panel-layout": {
     "height": 0,
     "visible": true,
     "width": 100
    }
   },
   "outputs": [],
   "source": [
    "%%time\n",
    "import owlplanner as owl\n",
    "\n",
    "plan = owl.Plan(['John', 'Sally'], ['1962-01-15', '1962-01-16'], [92, 92], 'john+sally')\n",
    "# plan.setPlotBackend(\"plotly\")\n",
    "plan.setAccountBalances(taxable=[200, 200], taxDeferred=[750, 750], taxFree=[50, 50], startDate='01-01')\n",
    "# Unrealistic empty contributions and wages\n",
    "plan.readHFP('../examples/HFP_john+sally.xlsx')\n",
    "# plan.setInterpolationMethod('s-curve')\n",
    "plan.setAllocationRatios('individual', generic=[[[60, 40, 0, 0], [60, 40, 0, 0]], [[60, 40, 0, 0], [60, 40, 0, 0]]])\n",
    "plan.setSocialSecurity([3000, 1800], [67, 67])\n",
    "#plan.setSpendingProfile('smile')\n",
    "plan.setSpendingProfile('flat')\n",
    "plan.setRates('historical average', 1990, 2023)\n",
    "plan.solve('maxBequest', options={'maxRothConversion': 200, 'netSpending': 100})\n",
    "plan.saveConfig()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "83d86eaa-4f7d-4d8a-a244-044b4c0665f4",
   "metadata": {
    "panel-layout": {
     "height": 586,
     "visible": true,
     "width": 100
    }
   },
   "outputs": [],
   "source": [
    "plan.setDefaultPlots('today')\n",
    "plan.summary()\n",
    "plan.showNetSpending()\n",
    "plan.showGrossIncome()\n",
    "plan.showTaxes()\n",
    "plan.showSources()\n",
    "plan.showAccounts()\n",
    "plan.saveWorkbook(True)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  },
  "panel-cell-order": [
   "a8088571-8fd2-4548-9263-bcec0d2a6edf",
   "795d0d10-e364-46e0-9707-1fc5afd8bdfb",
   "83d86eaa-4f7d-4d8a-a244-044b4c0665f4"
  ]
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
