{ "cells": [ { "cell_type": "markdown", "id": "7bd0db22", "metadata": {}, "source": [ "### Example of fee flow by index" ] }, { "cell_type": "code", "execution_count": null, "id": "e6b83a04-dfe0-4f2c-b27d-0cf950896415", "metadata": {}, "outputs": [], "source": [ "from absbox import Generic\n", "\n", "test01 = Generic(\n", " \"deal with bond schedule by index\"\n", " ,{\"collect\":[\"2021-03-01\",\"2021-06-30\"],\"pay\":[\"2021-06-15\",\"2021-07-20\"]\n", " ,\"payFreq\":[\"DayOfMonth\",20],\"poolFreq\":\"MonthEnd\",\"stated\":\"2030-01-01\"}\n", " ,{'assets':[[\"Mortgage\"\n", " ,{\"originBalance\":2200,\"originRate\":[\"fix\",0.045],\"originTerm\":30\n", " ,\"freq\":\"Monthly\",\"type\":\"Level\",\"originDate\":\"2021-02-01\"}\n", " ,{\"currentBalance\":2200\n", " ,\"currentRate\":0.08\n", " ,\"remainTerm\":30\n", " ,\"status\":\"current\"}]]\n", " ,'issuanceStat':{\"IssuanceBalance\":2300}}\n", " ,((\"acc01\",{\"balance\":0}),)\n", " ,((\"A1\",{\"balance\":1000\n", " ,\"rate\":0.07\n", " ,\"originBalance\":1000\n", " ,\"originRate\":0.07\n", " ,\"startDate\":\"2020-01-03\"\n", " ,\"rateType\":{\"Fixed\":0.08}\n", " ,\"bondType\": \"Sequential\"\n", " })\n", " ,(\"B\",{\"balance\":1000\n", " ,\"rate\":0.0\n", " ,\"originBalance\":1000\n", " ,\"originRate\":0.07\n", " ,\"startDate\":\"2020-01-03\"\n", " ,\"rateType\":{\"Fixed\":0.00}\n", " ,\"bondType\":{\"Equity\":None}\n", " }))\n", " ,((\"feeByIndex\",{\"type\":{\"flowByBondPeriod\": [ [1,80],[2,120],[3,300] ]},\"feeStart\":\"2021-06-15\"}),)\n", " ,{\"amortizing\":[\n", " [\"calcAndPayFee\",\"acc01\",['feeByIndex']]\n", " ,[\"accrueAndPayInt\",\"acc01\",[\"A1\"]]\n", " ,[\"payPrin\",\"acc01\",[\"A1\"]]\n", " ,[\"payPrin\",\"acc01\",[\"B\"]]\n", " ,[\"payIntResidual\",\"acc01\",\"B\"]\n", " ]}\n", " ,[[\"CollectedInterest\",\"acc01\"]\n", " ,[\"CollectedPrincipal\",\"acc01\"]\n", " ,[\"CollectedPrepayment\",\"acc01\"]\n", " ,[\"CollectedRecoveries\",\"acc01\"]]\n", " ,None\n", " ,None\n", " ,None\n", " ,None\n", " ,\"Amortizing\"\n", " ,None\n", " ,None\n", " ,None\n", " ,{\"BondPaidPeriod\": 0,\"PoolCollectedPeriod\":0}\n", " )" ] }, { "cell_type": "code", "execution_count": 52, "id": "eb9838ac-12ce-457b-adf8-7fb0f981cbdf", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Connecting engine server -> http://localhost:8081\n",
       "
\n" ], "text/plain": [ "\u001b[1;35mConnecting engine server -> \u001b[0m\u001b[1;4;35mhttp://localhost:8081\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Connected, local lib:0.28.7, server:0.42.0\n",
       "
\n" ], "text/plain": [ "✅\u001b[1;32mConnected, local li\u001b[0m\u001b[1;32mb:0\u001b[0m\u001b[1;32m.\u001b[0m\u001b[1;32m28.7\u001b[0m\u001b[1;32m, server:\u001b[0m\u001b[1;32m0.42\u001b[0m\u001b[1;32m.\u001b[0m\u001b[1;32m0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from absbox import API,EnginePath\n", "\n", "localAPI = API(EnginePath.DEV, check=False)" ] }, { "cell_type": "code", "execution_count": 53, "id": "cf1034ad-e1a1-4f70-b65d-18f47a3e0ba1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Warning Message from server:\n",
       "Bond B is not paid off\n",
       "
\n" ], "text/plain": [ "Warning Message from server:\n", "\u001b[1;33mBond B is not paid off\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
balancepaymentdue
date
2021-07-200.0080.000
2021-08-200.0040.000
2021-09-2098.8581.150
2021-10-20116.5581.150
2021-11-2053.1081.150
2021-12-200.0053.100
2022-01-200.000.000
2022-02-200.000.000
2022-03-200.000.000
2022-04-200.000.000
2022-05-200.000.000
2022-06-200.000.000
2022-07-200.000.000
2022-08-200.000.000
2022-09-200.000.000
2022-10-200.000.000
2022-11-200.000.000
2022-12-200.000.000
2023-01-200.000.000
2023-02-200.000.000
2023-03-200.000.000
2023-04-200.000.000
2023-05-200.000.000
2023-06-200.000.000
2023-07-200.000.000
2023-08-200.000.000
2023-09-200.000.000
\n", "
" ], "text/plain": [ " balance payment due\n", "date \n", "2021-07-20 0.00 80.00 0\n", "2021-08-20 0.00 40.00 0\n", "2021-09-20 98.85 81.15 0\n", "2021-10-20 116.55 81.15 0\n", "2021-11-20 53.10 81.15 0\n", "2021-12-20 0.00 53.10 0\n", "2022-01-20 0.00 0.00 0\n", "2022-02-20 0.00 0.00 0\n", "2022-03-20 0.00 0.00 0\n", "2022-04-20 0.00 0.00 0\n", "2022-05-20 0.00 0.00 0\n", "2022-06-20 0.00 0.00 0\n", "2022-07-20 0.00 0.00 0\n", "2022-08-20 0.00 0.00 0\n", "2022-09-20 0.00 0.00 0\n", "2022-10-20 0.00 0.00 0\n", "2022-11-20 0.00 0.00 0\n", "2022-12-20 0.00 0.00 0\n", "2023-01-20 0.00 0.00 0\n", "2023-02-20 0.00 0.00 0\n", "2023-03-20 0.00 0.00 0\n", "2023-04-20 0.00 0.00 0\n", "2023-05-20 0.00 0.00 0\n", "2023-06-20 0.00 0.00 0\n", "2023-07-20 0.00 0.00 0\n", "2023-08-20 0.00 0.00 0\n", "2023-09-20 0.00 0.00 0" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r = localAPI.run(test01,read=True)\n", "r['fees']['feeByIndex']" ] }, { "cell_type": "code", "execution_count": null, "id": "86c41ed8-ce84-4dac-ad87-e3b98bc097ee", "metadata": {}, "outputs": [], "source": [] } ], "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.3" } }, "nbformat": 4, "nbformat_minor": 5 }