{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "40ee081f", "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "import pandas\n", "pandas.set_option('display.max_rows', None)" ] }, { "cell_type": "code", "execution_count": null, "id": "6d073790", "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.28.18\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.28\u001b[0m\u001b[1;32m.\u001b[0m\u001b[1;32m18\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from absbox import API,EnginePath\n", "#localAPI = API(\"http://localhost:8081\",check=False)\n", "localAPI = API(EnginePath.DEV,check=False)" ] }, { "cell_type": "markdown", "id": "6761238e", "metadata": {}, "source": [ "### Revolving Feature Example" ] }, { "cell_type": "code", "execution_count": 3, "id": "adab1df7", "metadata": {}, "outputs": [], "source": [ "revol_asset1 = [\"Mortgage\"\n", " ,{\"originBalance\":220,\"originRate\":[\"fix\",0.045],\"originTerm\":30\n", " ,\"freq\":\"Monthly\",\"type\":\"Level\",\"originDate\":\"2021-07-01\"}\n", " ,{\"currentBalance\":220\n", " ,\"currentRate\":0.08\n", " ,\"remainTerm\":6\n", " ,\"status\":\"current\"}]\n", "\n", "revol_asset2 = [\"Mortgage\"\n", " ,{\"originBalance\":220,\"originRate\":[\"fix\",0.045],\"originTerm\":30\n", " ,\"freq\":\"Monthly\",\"type\":\"Level\",\"originDate\":\"2021-07-01\"}\n", " ,{\"currentBalance\":220\n", " ,\"currentRate\":0.08\n", " ,\"remainTerm\":12\n", " ,\"status\":\"current\"}]\n", "\n", "\n", "revolvingPool1 = ([\"constant\",revol_asset1]\n", " ,(\"Pool\",(\"Mortgage\",{\"CDR\":0.0},None,None,None)\n", " ,None\n", " ,None))\n", "\n", "revolvingPool2 = ([\"constant\",revol_asset2]\n", " ,(\"Pool\",(\"Mortgage\",{\"CDR\":0.1},None,None,None)\n", " ,None\n", " ,None))" ] }, { "cell_type": "markdown", "id": "68aa81a8", "metadata": {}, "source": [ "#### Single revolving pool, Single Deal Pool\n", "\n", "* A deal with a *Single* pool and there is only *One* revolving pool\n", "* Use `buyAsset` waterfall action" ] }, { "cell_type": "code", "execution_count": null, "id": "c36f4e4c", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
Warning Message from server:\n",
       "Account acc01 has cash to be distributed\n",
       "
\n" ], "text/plain": [ "Warning Message from server:\n", "\u001b[1;33mAccount acc01 has cash to be distributed\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", "
BalancePrincipalInterestPrepaymentDefaultRecoveryLossWACBorrowerNumPrepayPenaltyCumPrincipalCumPrepayCumDelinqCumDefaultCumRecoveryCumLoss
Date
2022-07-311235.1090.668.8300.0000.000.08NoneNone964.90000.0000.00
2022-08-311243.3391.268.2300.0000.000.08NoneNone1056.16000.0000.00
2022-09-301142.6599.808.2700.8800.880.08NoneNone1155.96000.8800.88
2022-10-311041.47100.407.6000.7800.780.08NoneNone1256.36001.6601.66
2022-11-30939.76100.986.9300.7300.730.08NoneNone1357.34002.3902.39
\n", "
" ], "text/plain": [ " Balance Principal Interest Prepayment Default Recovery Loss \\\n", "Date \n", "2022-07-31 1235.10 90.66 8.83 0 0.00 0 0.00 \n", "2022-08-31 1243.33 91.26 8.23 0 0.00 0 0.00 \n", "2022-09-30 1142.65 99.80 8.27 0 0.88 0 0.88 \n", "2022-10-31 1041.47 100.40 7.60 0 0.78 0 0.78 \n", "2022-11-30 939.76 100.98 6.93 0 0.73 0 0.73 \n", "\n", " WAC BorrowerNum PrepayPenalty CumPrincipal CumPrepay \\\n", "Date \n", "2022-07-31 0.08 None None 964.90 0 \n", "2022-08-31 0.08 None None 1056.16 0 \n", "2022-09-30 0.08 None None 1155.96 0 \n", "2022-10-31 0.08 None None 1256.36 0 \n", "2022-11-30 0.08 None None 1357.34 0 \n", "\n", " CumDelinq CumDefault CumRecovery CumLoss \n", "Date \n", "2022-07-31 0 0.00 0 0.00 \n", "2022-08-31 0 0.00 0 0.00 \n", "2022-09-30 0 0.88 0 0.88 \n", "2022-10-31 0 1.66 0 1.66 \n", "2022-11-30 0 2.39 0 2.39 " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from absbox.local.generic import Generic\n", "\n", "test00 = 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\":24\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", " ,[\"payInt\",\"acc01\",[\"A1\"]]\n", " ,[\"If\",[\"=\",\"2022-08-20\"]\n", " ,[\"buyAsset\",[\"Current|Defaulted\",1.0,0],\"acc01\"]\n", " ]\n", " ,[\"payPrin\",\"acc01\",[\"A1\"]]\n", " ,[\"payPrin\",\"acc01\",[\"B\"]]\n", " ,[\"payPrinResidual\",\"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", ")\n", "\n", "\n", "r = localAPI.run(test00\n", " ,runAssump=[(\"revolving\",*revolvingPool2)]\n", " ,read=True)\n", "\n", "r['pool']['flow']['PoolConsol'].loc[\"2022-07-31\":\"2022-11-30\"]" ] }, { "cell_type": "markdown", "id": "f47c3d83", "metadata": {}, "source": [ "#### Single revolving pool, Multiple Deal Pool\n", "\n", "* The deal has multiple pools ( which model as a map)\n", "* Use `buyAssetFrom` waterfall action\n", " * ` [\"buyAsset2\", , , , , ] `" ] }, { "cell_type": "code", "execution_count": null, "id": "8ec07ef5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Warning Message from server:\n",
       "Account acc01 has cash to be distributed\n",
       "
\n" ], "text/plain": [ "Warning Message from server:\n", "\u001b[1;33mAccount acc01 has cash to be distributed\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", "
BalancePrincipalInterestPrepaymentDefaultRecoveryLossWACBorrowerNumPrepayPenaltyCumPrincipalCumPrepayCumDelinqCumDefaultCumRecoveryCumLoss
Date
2022-07-311007.3273.957.2000.0000.000.08NoneNone1192.68000.0000.00
2022-08-311014.0474.436.7100.0000.000.08NoneNone1267.11000.0000.00
2022-09-30931.9281.406.7400.7200.720.08NoneNone1348.51000.7200.72
2022-10-31849.4181.886.1900.6300.630.08NoneNone1430.39001.3501.35
2022-11-30766.4682.365.6500.5900.590.08NoneNone1512.75001.9401.94
\n", "
" ], "text/plain": [ " Balance Principal Interest Prepayment Default Recovery Loss \\\n", "Date \n", "2022-07-31 1007.32 73.95 7.20 0 0.00 0 0.00 \n", "2022-08-31 1014.04 74.43 6.71 0 0.00 0 0.00 \n", "2022-09-30 931.92 81.40 6.74 0 0.72 0 0.72 \n", "2022-10-31 849.41 81.88 6.19 0 0.63 0 0.63 \n", "2022-11-30 766.46 82.36 5.65 0 0.59 0 0.59 \n", "\n", " WAC BorrowerNum PrepayPenalty CumPrincipal CumPrepay \\\n", "Date \n", "2022-07-31 0.08 None None 1192.68 0 \n", "2022-08-31 0.08 None None 1267.11 0 \n", "2022-09-30 0.08 None None 1348.51 0 \n", "2022-10-31 0.08 None None 1430.39 0 \n", "2022-11-30 0.08 None None 1512.75 0 \n", "\n", " CumDelinq CumDefault CumRecovery CumLoss \n", "Date \n", "2022-07-31 0 0.00 0 0.00 \n", "2022-08-31 0 0.00 0 0.00 \n", "2022-09-30 0 0.72 0 0.72 \n", "2022-10-31 0 1.35 0 1.35 \n", "2022-11-30 0 1.94 0 1.94 " ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test00_A = 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", " ,{\"PoolA\":{'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", " ,\"PoolB\":{'assets':[[\"Loan\"\n", " ,{\"originBalance\": 80000\n", " ,\"originRate\": [\"fix\",0.08]\n", " ,\"originTerm\": 36\n", " ,\"freq\": \"Monthly\"\n", " ,\"type\": \"i_p\"\n", " ,\"originDate\": \"2021-02-01\"}\n", " ,{\"currentBalance\": 65000\n", " ,\"currentRate\": 0.06\n", " ,\"remainTerm\": 30\n", " ,\"status\": \"Current\"}]]}\n", " }\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", " ,[\"payInt\",\"acc01\",[\"A1\"]]\n", " ,[\"If\",[\"=\",\"2022-08-20\"]\n", " ,[\"buyAsset2\",[\"Current|Defaulted\",1.0,0],\"acc01\",None,None,\"PoolA\"]\n", " ]\n", " ,[\"payPrin\",\"acc01\",[\"A1\"]]\n", " ,[\"payPrin\",\"acc01\",[\"B\"]]\n", " ,[\"payPrinResidual\",\"acc01\",[\"B\"]]\n", " ]}\n", " ,[[[\"PoolA\"],\"CollectedCash\",\"acc01\"]\n", " ,[[\"PoolB\"],\"CollectedCash\",\"acc02\"]]\n", " ,None\n", " ,None\n", " ,None\n", " ,None\n", " ,(\"PreClosing\",\"Amortizing\")\n", ")\n", "\n", "r = localAPI.run(test00_A\n", " ,runAssump=[(\"revolving\",*revolvingPool2)]\n", " ,read=True)\n", "\n", "r['pool']['flow']['PoolA'].loc[\"2022-07-31\":\"2022-11-30\"]" ] }, { "cell_type": "code", "execution_count": 15, "id": "85c581fa", "metadata": {}, "outputs": [ { "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", "
BalancePrincipalInterestPrepaymentDefaultRecoveryLossWACCumPrincipalCumPrepayCumDelinqCumDefaultCumRecoveryCumLoss
Date
2022-07-31650000324.9300000.06000000
2022-08-31650000335.7900000.06000000
2022-09-30650000335.7900000.06000000
2022-10-31650000324.9300000.06000000
2022-11-30650000335.7900000.06000000
\n", "
" ], "text/plain": [ " Balance Principal Interest Prepayment Default Recovery Loss \\\n", "Date \n", "2022-07-31 65000 0 324.93 0 0 0 0 \n", "2022-08-31 65000 0 335.79 0 0 0 0 \n", "2022-09-30 65000 0 335.79 0 0 0 0 \n", "2022-10-31 65000 0 324.93 0 0 0 0 \n", "2022-11-30 65000 0 335.79 0 0 0 0 \n", "\n", " WAC CumPrincipal CumPrepay CumDelinq CumDefault CumRecovery \\\n", "Date \n", "2022-07-31 0.06 0 0 0 0 0 \n", "2022-08-31 0.06 0 0 0 0 0 \n", "2022-09-30 0.06 0 0 0 0 0 \n", "2022-10-31 0.06 0 0 0 0 0 \n", "2022-11-30 0.06 0 0 0 0 0 \n", "\n", " CumLoss \n", "Date \n", "2022-07-31 0 \n", "2022-08-31 0 \n", "2022-09-30 0 \n", "2022-10-31 0 \n", "2022-11-30 0 " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r['pool']['flow']['PoolB'].loc[\"2022-07-31\":\"2022-11-30\"]" ] }, { "cell_type": "markdown", "id": "6f0c5e96", "metadata": {}, "source": [ "#### Multiple revolving pool, Multiple Deal Pool\n", "\n", "A deal transaction may have multiple pools which doesn't share same asset type. In this case, the `PoolA` has a list of `Mortgage` while `PoolB` has a list of `Loan`.\n", "\n", "In the `buyAsset2` action ,user can specify the :\n", "* `source` revolving pool from the assumption where the buy action perform from.\n", "* `target` pool which the new bought asset belong to" ] }, { "cell_type": "code", "execution_count": null, "id": "27073d66", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Warning Message from server:\n",
       "Account acc01 has cash to be distributed\n",
       "
\n" ], "text/plain": [ "Warning Message from server:\n", "\u001b[1;33mAccount acc01 has cash to be distributed\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", "
BalancePrincipalInterestPrepaymentDefaultRecoveryLossWACCumPrincipalCumPrepayCumDelinqCumDefaultCumRecoveryCumLoss
Date
2022-07-3165000.000.0324.9300.0000.000.060.0000.0000.00
2022-08-3165081.150.0335.7900.0000.000.060.0000.0000.00
2022-09-3065080.430.0336.1900.7200.720.060.0000.7200.72
2022-10-3165079.740.0325.3200.6900.690.060.0001.4101.41
2022-11-3065079.030.0336.1900.7100.710.060.0002.1202.12
\n", "
" ], "text/plain": [ " Balance Principal Interest Prepayment Default Recovery \\\n", "Date \n", "2022-07-31 65000.00 0.0 324.93 0 0.00 0 \n", "2022-08-31 65081.15 0.0 335.79 0 0.00 0 \n", "2022-09-30 65080.43 0.0 336.19 0 0.72 0 \n", "2022-10-31 65079.74 0.0 325.32 0 0.69 0 \n", "2022-11-30 65079.03 0.0 336.19 0 0.71 0 \n", "\n", " Loss WAC CumPrincipal CumPrepay CumDelinq CumDefault \\\n", "Date \n", "2022-07-31 0.00 0.06 0.0 0 0 0.00 \n", "2022-08-31 0.00 0.06 0.0 0 0 0.00 \n", "2022-09-30 0.72 0.06 0.0 0 0 0.72 \n", "2022-10-31 0.69 0.06 0.0 0 0 1.41 \n", "2022-11-30 0.71 0.06 0.0 0 0 2.12 \n", "\n", " CumRecovery CumLoss \n", "Date \n", "2022-07-31 0 0.00 \n", "2022-08-31 0 0.00 \n", "2022-09-30 0 0.72 \n", "2022-10-31 0 1.41 \n", "2022-11-30 0 2.12 " ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test02 = 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", " ,{\"PoolA\":{'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", " ,\"PoolB\":{'assets':[[\"Loan\"\n", " ,{\"originBalance\": 80000\n", " ,\"originRate\": [\"fix\",0.08]\n", " ,\"originTerm\": 36\n", " ,\"freq\": \"Monthly\"\n", " ,\"type\": \"i_p\"\n", " ,\"originDate\": \"2021-02-01\"}\n", " ,{\"currentBalance\": 65000\n", " ,\"currentRate\": 0.06\n", " ,\"remainTerm\": 30\n", " ,\"status\": \"Current\"}]\n", " ]\n", " }\n", " }\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", " ,[\"payInt\",\"acc01\",[\"A1\"]]\n", " ,[\"If\",[\"=\",\"2022-08-20\"]\n", " ,[\"buyAsset2\",[\"Current|Defaulted\",1.0,0],\"acc01\",None,\"Pool3\",\"PoolB\"]\n", " ]\n", " ,[\"payPrin\",\"acc01\",[\"A1\"]]\n", " ,[\"payPrin\",\"acc01\",[\"B\"]]\n", " ,[\"payPrinResidual\",\"acc01\",[\"B\"]]\n", " ]}\n", " ,[[[\"PoolA\"],\"CollectedCash\",\"acc01\"]\n", " ,[[\"PoolB\"],\"CollectedCash\",\"acc02\"]]\n", " ,None\n", " ,None\n", " ,None\n", " ,None\n", " ,(\"PreClosing\",\"Amortizing\")\n", ")\n", "\n", "\n", "revol_asset3 =[\"Loan\"\n", " ,{\"originBalance\": 80000\n", " ,\"originRate\": [\"fix\",0.08]\n", " ,\"originTerm\": 36\n", " ,\"freq\": \"Monthly\"\n", " ,\"type\": \"i_p\"\n", " ,\"originDate\": \"2021-02-01\"}\n", " ,{\"currentBalance\": 65000\n", " ,\"currentRate\": 0.06\n", " ,\"remainTerm\": 30\n", " ,\"status\": \"Current\"}]\n", "\n", "\n", "revolvingPool3 = ([\"constant\",revol_asset3]\n", " ,(\"Pool\",(\"Loan\",{\"CDR\":0.1},None,None,None)\n", " ,None\n", " ,None))\n", "\n", "r = localAPI.run(test02\n", " ,runAssump=[(\"revolving\"\n", " ,{\"Pool1\":revolvingPool1,\"Pool3\":revolvingPool3})]\n", " ,read=True)\n", "\n", "r['pool']['flow']['PoolB'].loc[\"2022-07-31\":\"2022-11-30\"]" ] } ], "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.9" } }, "nbformat": 4, "nbformat_minor": 5 }