{ "cells": [ { "cell_type": "markdown", "id": "c3524e44", "metadata": {}, "source": [ "### Refinance by rate example\n", "\n", "It's common that in `CLO` transaction ,the equity holder has the option to reset the bond's interest rate." ] }, { "cell_type": "code", "execution_count": null, "id": "66dbbaed", "metadata": {}, "outputs": [], "source": [ "from absbox import Generic\n", "\n", "test01 = Generic(\n", " \"TEST01\"\n", " ,{\"cutoff\":\"2021-03-01\",\"closing\":\"2021-06-15\",\"firstPay\":\"2021-07-26\"\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\":20\n", " ,\"status\":\"current\"}]]}\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\":None}})\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", " ,((\"trusteeFee\",{\"type\":{\"fixFee\":30},\"feeStart\":\"2021-06-15\"}),)\n", " ,{\"amortizing\":[\n", " [\"payFee\",\"acc01\",['trusteeFee']]\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", " ,(\"PreClosing\",\"Amortizing\")\n", " )" ] }, { "cell_type": "code", "execution_count": 2, "id": "478d148e", "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.29.2\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.29\u001b[0m\u001b[1;32m.\u001b[0m\u001b[1;32m2\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from absbox import API,EnginePath\n", "\n", "localAPI = API(EnginePath.DEV, lang='english', check=False)" ] }, { "cell_type": "markdown", "id": "06b57835", "metadata": {}, "source": [ "By using `refinance` ,user can set assumption to change the rate type of a bond in future .\n", "\n", "User can setup different scenario to see how different refinancing options affecting equity returns." ] }, { "cell_type": "code", "execution_count": 3, "id": "4fe0e978", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Warning Message from server:\n",
"\n",
"\n"
],
"text/plain": [
"Warning Message from server:\n",
"\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"runAssumption = [(\"refinance\"\n",
" ,(\"byRate\",\"2022-07-30\",\"acc01\", \"A1\", {\"Fixed\":0.05}))\n",
" ]\n",
"\n",
"\n",
"r = localAPI.run(test01\n",
" ,runAssump=runAssumption\n",
" ,read=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cf8ef104",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"| \n", " | balance | \n", "interest | \n", "principal | \n", "rate | \n", "cash | \n", "intDue | \n", "intOverInt | \n", "factor | \n", "memo | \n", "
|---|---|---|---|---|---|---|---|---|---|
| date | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
| 2021-07-26 | \n", "1000.00 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "7.86 | \n", "0 | \n", "1.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2021-08-20 | \n", "1000.00 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "12.65 | \n", "0 | \n", "1.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2021-09-20 | \n", "1000.00 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "18.59 | \n", "0 | \n", "1.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2021-10-20 | \n", "1000.00 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "24.34 | \n", "0 | \n", "1.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2021-11-20 | \n", "1000.00 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "30.28 | \n", "0 | \n", "1.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2021-12-20 | \n", "1000.00 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "36.03 | \n", "0 | \n", "1.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-01-20 | \n", "1000.00 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "41.97 | \n", "0 | \n", "1.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-02-20 | \n", "960.05 | \n", "47.91 | \n", "39.95 | \n", "0.07 | \n", "87.86 | \n", "0.00 | \n", "0 | \n", "0.96005 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-03-20 | \n", "847.34 | \n", "5.15 | \n", "112.71 | \n", "0.07 | \n", "117.86 | \n", "0.00 | \n", "0 | \n", "0.84734 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-04-20 | \n", "734.51 | \n", "5.03 | \n", "112.83 | \n", "0.07 | \n", "117.86 | \n", "0.00 | \n", "0 | \n", "0.73451 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-05-20 | \n", "620.87 | \n", "4.22 | \n", "113.64 | \n", "0.07 | \n", "117.86 | \n", "0.00 | \n", "0 | \n", "0.62087 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-06-20 | \n", "506.71 | \n", "3.69 | \n", "114.16 | \n", "0.07 | \n", "117.85 | \n", "0.00 | \n", "0 | \n", "0.50671 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-07-20 | \n", "391.76 | \n", "2.91 | \n", "114.95 | \n", "0.07 | \n", "117.86 | \n", "0.00 | \n", "0 | \n", "0.39176 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-07-30 | \n", "391.76 | \n", "0.00 | \n", "0.00 | \n", "0.07 | \n", "0.00 | \n", "0.75 | \n", "0 | \n", "0.39176 | \n", "<PayInt:A1> | \n", "
| 2022-08-20 | \n", "275.78 | \n", "1.87 | \n", "115.98 | \n", "0.05 | \n", "117.85 | \n", "0.00 | \n", "0 | \n", "0.27578 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-09-20 | \n", "159.10 | \n", "1.17 | \n", "116.68 | \n", "0.05 | \n", "117.85 | \n", "0.00 | \n", "0 | \n", "0.15910 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-10-20 | \n", "41.89 | \n", "0.65 | \n", "117.21 | \n", "0.05 | \n", "117.86 | \n", "0.00 | \n", "0 | \n", "0.04189 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "
| 2022-11-20 | \n", "0.00 | \n", "0.17 | \n", "41.89 | \n", "0.05 | \n", "42.06 | \n", "0.00 | \n", "0 | \n", "0.00000 | \n", "[<PayInt:A1>, <PayPrin:A1>] | \n", "