{
"cells": [
{
"cell_type": "markdown",
"id": "751fa0b5-8962-4eea-ad90-5c1e53826a78",
"metadata": {},
"source": [
"### Inspect Example"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c9f9f9a2-699a-42da-8da0-bda258fdfe89",
"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",
" , [\"inspect\",\"cleanUpVar1\",(\"poolBalance\",)]\n",
" ]\n",
" ,\"cleanUp\":[[\"inspect\",\"cleanUpVar2\",(\"poolBalance\",)]\n",
" ,]\n",
" }\n",
" ,[[\"CollectedInterest\",\"acc01\"]\n",
" ,[\"CollectedPrincipal\",\"acc01\"]\n",
" ,[\"CollectedPrepayment\",\"acc01\"]\n",
" ,[\"CollectedRecoveries\",\"acc01\"]]\n",
" ,None\n",
" ,None\n",
" ,None\n",
" ,{\n",
" \"AfterCollect\":{\n",
" \"Mytrigger0\":{\"condition\":[\"date\",\">\",\"2022-01-01\"]\n",
" ,\"effects\":(\"actions\"\n",
" ,[\"inspect\",\"cleanUpVar3\",(\"poolBalance\",)]\n",
" )\n",
" ,\"status\":False\n",
" ,\"curable\":False}\n",
" }\n",
" }\n",
" ,(\"PreClosing\",\"Amortizing\")\n",
" )\n"
]
},
{
"cell_type": "code",
"execution_count": 65,
"id": "88764d10-c902-489b-b9e8-1defca48a9b5",
"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.5, server:0.30.4\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.5\u001b[0m\u001b[1;32m, server:\u001b[0m\u001b[1;32m0.30\u001b[0m\u001b[1;32m.\u001b[0m\u001b[1;32m4\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from absbox import API,mkDeal,readInspect,EnginePath\n",
"localAPI = API(EnginePath.DEV,check=False)"
]
},
{
"cell_type": "code",
"execution_count": 66,
"id": "d54c2955-6700-4748-ba4f-06121fec8749",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"Warning Message from server:\n",
"Bond A1 is not paid off\n",
"Bond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"\n"
],
"text/plain": [
"Warning Message from server:\n",
"\u001b[1;33mBond A1 is not paid off\u001b[0m\n",
"\u001b[1;33mBond B is not paid off\u001b[0m\n",
"\u001b[1;33mAccount acc01 has cash to be distributed\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"r = localAPI.run(test01\n",
" ,runAssump = [(\"call\", (\"if\", [\"date\",\">\",\"2022-05-01\"]))]\n",
" ,read=True)"
]
},
{
"cell_type": "code",
"execution_count": 67,
"id": "9a28cb99-4f04-42f5-84f5-4f91f0673f0c",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" From | \n",
" To | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 2021-06-15 | \n",
" PreClosing | \n",
" Amortizing | \n",
"
\n",
" \n",
" | 1 | \n",
" 2022-05-20 | \n",
" Amortizing | \n",
" Called | \n",
"
\n",
" \n",
" | 2 | \n",
" 2022-05-20 | \n",
" DealEnd | \n",
" Clean Up | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date From To\n",
"0 2021-06-15 PreClosing Amortizing\n",
"1 2022-05-20 Amortizing Called\n",
"2 2022-05-20 DealEnd Clean Up"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r['result']['status']"
]
},
{
"cell_type": "code",
"execution_count": 68,
"id": "e3ec122b-e929-4a85-ac32-249362a15a2a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" cleanUpVar1 | \n",
" cleanUpVar3 | \n",
" cleanUpVar2 | \n",
"
\n",
" \n",
" | Date | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" | 2021-07-26 | \n",
" 2200.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2021-08-20 | \n",
" 2200.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2021-09-20 | \n",
" 2200.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2021-10-20 | \n",
" 2200.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2021-11-20 | \n",
" 2200.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2021-12-20 | \n",
" 2200.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2022-01-20 | \n",
" 2200.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2022-01-31 | \n",
" NaN | \n",
" 2096.80 | \n",
" NaN | \n",
"
\n",
" \n",
" | 2022-02-20 | \n",
" 2096.80 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2022-03-20 | \n",
" 1992.91 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2022-04-20 | \n",
" 1888.33 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" | 2022-05-20 | \n",
" NaN | \n",
" NaN | \n",
" 1783.05 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" cleanUpVar1 cleanUpVar3 cleanUpVar2\n",
"Date \n",
"2021-07-26 2200.00 NaN NaN\n",
"2021-08-20 2200.00 NaN NaN\n",
"2021-09-20 2200.00 NaN NaN\n",
"2021-10-20 2200.00 NaN NaN\n",
"2021-11-20 2200.00 NaN NaN\n",
"2021-12-20 2200.00 NaN NaN\n",
"2022-01-20 2200.00 NaN NaN\n",
"2022-01-31 NaN 2096.80 NaN\n",
"2022-02-20 2096.80 NaN NaN\n",
"2022-03-20 1992.91 NaN NaN\n",
"2022-04-20 1888.33 NaN NaN\n",
"2022-05-20 NaN NaN 1783.05"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"readInspect(r['result'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0100214d-5fe8-4c61-b726-f6efaaf3468b",
"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.11.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}