{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Run Asset Pool 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Connecting engine server -> https://absbox.org/api/dev\n",
       "
\n" ], "text/plain": [ "Connecting engine server -> \u001b[4;94mhttps://absbox.org/api/dev\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "/home/xiaoyu/repo/AbsBox/lib/python3.13/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'absbox.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n", " warnings.warn(\n" ] }, { "data": { "text/html": [ "
✅Connected, local lib:0.46.5, server:0.50.1\n",
       "
\n" ], "text/plain": [ "✅Connected, local li\u001b[1;92mb:0\u001b[0m.\u001b[1;36m46.5\u001b[0m, server:\u001b[1;36m0.50\u001b[0m.\u001b[1;36m1\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", "metadata": {}, "source": [ "### Pool\n", "\n", "In `Pool` , it will have a field named `assets` ,which contains a list of `assets`" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "mortgage1 = [\"Mortgage\"\n", " ,{\"originBalance\": 12000.0\n", " ,\"originRate\": [\"fix\",0.045]\n", " ,\"originTerm\": 40\n", " ,\"freq\": \"monthly\"\n", " ,\"type\": \"level\"\n", " ,\"originDate\": \"2021-02-01\"}\n", " ,{\"currentBalance\": 10000.0\n", " ,\"currentRate\": 0.075\n", " ,\"remainTerm\": 30\n", " ,\"status\": \"current\"}]\n", "\n", "mortgage2 = [\"Mortgage\"\n", " ,{\"originBalance\": 8000.0\n", " ,\"originRate\": [\"fix\",0.045]\n", " ,\"originTerm\": 25\n", " ,\"freq\": \"monthly\"\n", " ,\"type\": \"level\"\n", " ,\"originDate\": \"2021-02-01\"}\n", " ,{\"currentBalance\": 6000.0\n", " ,\"currentRate\": 0.075\n", " ,\"remainTerm\": 15\n", " ,\"status\": \"current\"}]\n", "\n", "myPool = {'assets':[ mortgage1, mortgage2 ],\n", " 'cutoffDate':\"2022-03-01\"}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Assumption on Pool Level\n", "\n", "User can set assumption on pool level ,which suggests the assumption will be applied to all the assets in the pool." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/xiaoyu/repo/AbsBox/lib/python3.13/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'absbox.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n", " warnings.warn(\n" ] }, { "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", "
BalancePrincipalInterestPrepaymentDefaultRecoveryLossWACBorrowerNumPrepayPenaltyCumPrincipalCumPrepayCumDelinqCumDefaultCumRecoveryCumLoss
Date
2022-03-0113891.98693.7891.15011.24011.240.075NoneNone693.780011.24011.24
2022-04-0113182.62697.5286.74011.84011.840.075NoneNone1391.300023.08023.08
2022-05-0112470.45701.3082.31010.87010.870.075NoneNone2092.600033.95033.95
2022-06-0111754.74705.0877.87010.63010.630.075NoneNone2797.680044.58044.58
2022-07-0111036.14708.9073.4009.7009.700.075NoneNone3506.580054.28054.28
\n", "
" ], "text/plain": [ " Balance Principal Interest Prepayment Default Recovery \\\n", "Date \n", "2022-03-01 13891.98 693.78 91.15 0 11.24 0 \n", "2022-04-01 13182.62 697.52 86.74 0 11.84 0 \n", "2022-05-01 12470.45 701.30 82.31 0 10.87 0 \n", "2022-06-01 11754.74 705.08 77.87 0 10.63 0 \n", "2022-07-01 11036.14 708.90 73.40 0 9.70 0 \n", "\n", " Loss WAC BorrowerNum PrepayPenalty CumPrincipal CumPrepay \\\n", "Date \n", "2022-03-01 11.24 0.075 None None 693.78 0 \n", "2022-04-01 11.84 0.075 None None 1391.30 0 \n", "2022-05-01 10.87 0.075 None None 2092.60 0 \n", "2022-06-01 10.63 0.075 None None 2797.68 0 \n", "2022-07-01 9.70 0.075 None None 3506.58 0 \n", "\n", " CumDelinq CumDefault CumRecovery CumLoss \n", "Date \n", "2022-03-01 0 11.24 0 11.24 \n", "2022-04-01 0 23.08 0 23.08 \n", "2022-05-01 0 33.95 0 33.95 \n", "2022-06-01 0 44.58 0 44.58 \n", "2022-07-01 0 54.28 0 54.28 " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r = localAPI.runPool(myPool\n", " ,poolAssump=(\"Pool\",(\"Mortgage\",{\"CDR\":0.01},None,None,None)\n", " ,None\n", " ,None)\n", " ,read=True)\n", "\n", "r['PoolConsol']['flow'].head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Assumption on Asset Level" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/xiaoyu/repo/AbsBox/lib/python3.13/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'absbox.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n", " warnings.warn(\n" ] }, { "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", "
BalancePrincipalInterestPrepaymentDefaultRecoveryLossWACBorrowerNumPrepayPenaltyCumPrincipalCumPrepayCumDelinqCumDefaultCumRecoveryCumLoss
Date
2022-03-0113891.98693.7891.154.027.2207.220.075NoneNone693.784.0207.2207.22
2022-04-0113182.62697.5286.744.127.7207.720.075NoneNone1391.308.14014.94014.94
2022-05-0112470.45701.3082.313.667.2107.210.075NoneNone2092.6011.80022.15022.15
2022-06-0111754.74705.0877.873.457.1807.180.075NoneNone2797.6815.25029.33029.33
2022-07-0111036.14708.9073.403.016.6906.690.075NoneNone3506.5818.26036.02036.02
\n", "
" ], "text/plain": [ " Balance Principal Interest Prepayment Default Recovery \\\n", "Date \n", "2022-03-01 13891.98 693.78 91.15 4.02 7.22 0 \n", "2022-04-01 13182.62 697.52 86.74 4.12 7.72 0 \n", "2022-05-01 12470.45 701.30 82.31 3.66 7.21 0 \n", "2022-06-01 11754.74 705.08 77.87 3.45 7.18 0 \n", "2022-07-01 11036.14 708.90 73.40 3.01 6.69 0 \n", "\n", " Loss WAC BorrowerNum PrepayPenalty CumPrincipal CumPrepay \\\n", "Date \n", "2022-03-01 7.22 0.075 None None 693.78 4.02 \n", "2022-04-01 7.72 0.075 None None 1391.30 8.14 \n", "2022-05-01 7.21 0.075 None None 2092.60 11.80 \n", "2022-06-01 7.18 0.075 None None 2797.68 15.25 \n", "2022-07-01 6.69 0.075 None None 3506.58 18.26 \n", "\n", " CumDelinq CumDefault CumRecovery CumLoss \n", "Date \n", "2022-03-01 0 7.22 0 7.22 \n", "2022-04-01 0 14.94 0 14.94 \n", "2022-05-01 0 22.15 0 22.15 \n", "2022-06-01 0 29.33 0 29.33 \n", "2022-07-01 0 36.02 0 36.02 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "assetLevelAssump = (\"ByIndex\"\n", " ,([0],((\"Mortgage\",{\"CDR\":0.01},None,None,None)\n", " ,None\n", " ,None))\n", " ,([1],((\"Mortgage\",None,{\"CPR\":0.01},None,None)\n", " ,None\n", " ,None))\n", " )\n", "\n", "r = localAPI.runPool(myPool\n", " ,poolAssump=assetLevelAssump\n", " ,read=True)\n", "\n", "r['PoolConsol']['flow'].head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Cumulative Stats\n", "\n", "User can annotate the `HistoryDefaults` which suggusts as of the `cutoffDate`, how much balance is in status of `Default`" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/xiaoyu/repo/AbsBox/lib/python3.13/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'absbox.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n", " warnings.warn(\n" ] }, { "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", "
BalancePrincipalInterestPrepaymentDefaultRecoveryLossWACBorrowerNumPrepayPenaltyCumPrincipalCumPrepayCumDelinqCumDefaultCumRecoveryCumLoss
Date
2022-03-0113891.98693.7891.15011.24011.240.075NoneNone693.780011.24011.24
2022-04-0113182.62697.5286.74011.84011.840.075NoneNone1391.300023.08023.08
2022-05-0112470.45701.3082.31010.87010.870.075NoneNone2092.600033.95033.95
2022-06-0111754.74705.0877.87010.63010.630.075NoneNone2797.680044.58044.58
2022-07-0111036.14708.9073.4009.7009.700.075NoneNone3506.580054.28054.28
\n", "
" ], "text/plain": [ " Balance Principal Interest Prepayment Default Recovery \\\n", "Date \n", "2022-03-01 13891.98 693.78 91.15 0 11.24 0 \n", "2022-04-01 13182.62 697.52 86.74 0 11.84 0 \n", "2022-05-01 12470.45 701.30 82.31 0 10.87 0 \n", "2022-06-01 11754.74 705.08 77.87 0 10.63 0 \n", "2022-07-01 11036.14 708.90 73.40 0 9.70 0 \n", "\n", " Loss WAC BorrowerNum PrepayPenalty CumPrincipal CumPrepay \\\n", "Date \n", "2022-03-01 11.24 0.075 None None 693.78 0 \n", "2022-04-01 11.84 0.075 None None 1391.30 0 \n", "2022-05-01 10.87 0.075 None None 2092.60 0 \n", "2022-06-01 10.63 0.075 None None 2797.68 0 \n", "2022-07-01 9.70 0.075 None None 3506.58 0 \n", "\n", " CumDelinq CumDefault CumRecovery CumLoss \n", "Date \n", "2022-03-01 0 11.24 0 11.24 \n", "2022-04-01 0 23.08 0 23.08 \n", "2022-05-01 0 33.95 0 33.95 \n", "2022-06-01 0 44.58 0 44.58 \n", "2022-07-01 0 54.28 0 54.28 " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "myPool2 = {'assets':[ mortgage1, mortgage2 ],\n", " 'cutoffDate':\"2022-03-01\"\n", " ,'issuanceStat':{\"HistoryDefaults\":200,\"HistoryLoss\":50}}\n", "\n", "r = localAPI.runPool(myPool2\n", " ,poolAssump=(\"Pool\",(\"Mortgage\",{\"CDR\":0.01},None,None,None)\n", " ,None\n", " ,None)\n", " ,read=True)\n", "\n", "r['PoolConsol']['flow'].head()" ] }, { "cell_type": "code", "execution_count": null, "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.13.3" } }, "nbformat": 4, "nbformat_minor": 4 }