{
"cells": [
{
"cell_type": "markdown",
"id": "ff751996",
"metadata": {},
"source": [
"### Combonation of sensitivity run"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "8ac93d36",
"metadata": {},
"outputs": [],
"source": [
"from absbox import API,EnginePath\n",
"from absbox import Generic\n",
"from absbox.examples import test01"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "63146b27",
"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": [
"localAPI = API(EnginePath.DEV, lang='english', check=False)"
]
},
{
"cell_type": "markdown",
"id": "db78a160",
"metadata": {},
"source": [
"Passing 3 maps to the ``runByCombo()``"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "65eb232f",
"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": [
"Warning Message from server for A^^^p^o^o^l^A^^^D^e^a^l^R^u^n^A:Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,1)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for A^^^p^o^o^l^A^^^D^e^a^l^R^u^n^\u001b[1;92mA:Acc\u001b[0mount acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m1\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Warning Message from server for A^^^p^o^o^l^A^^^D^e^a^l^R^u^n^B:Bond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,4)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for A^^^p^o^o^l^A^^^D^e^a^l^R^u^n^\u001b[1;92mB:B\u001b[0mond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m4\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Warning Message from server for A^^^p^o^o^l^B^^^D^e^a^l^R^u^n^A:Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,1)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for A^^^p^o^o^l^B^^^D^e^a^l^R^u^n^\u001b[1;92mA:Acc\u001b[0mount acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m1\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Warning Message from server for A^^^p^o^o^l^B^^^D^e^a^l^R^u^n^B:Bond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,4)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for A^^^p^o^o^l^B^^^D^e^a^l^R^u^n^\u001b[1;92mB:B\u001b[0mond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m4\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Warning Message from server for B^^^p^o^o^l^A^^^D^e^a^l^R^u^n^A:Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,1)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for B^^^p^o^o^l^A^^^D^e^a^l^R^u^n^\u001b[1;92mA:Acc\u001b[0mount acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m1\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Warning Message from server for B^^^p^o^o^l^A^^^D^e^a^l^R^u^n^B:Bond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,4)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for B^^^p^o^o^l^A^^^D^e^a^l^R^u^n^\u001b[1;92mB:B\u001b[0mond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m4\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Warning Message from server for B^^^p^o^o^l^B^^^D^e^a^l^R^u^n^A:Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,1)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for B^^^p^o^o^l^B^^^D^e^a^l^R^u^n^\u001b[1;92mA:Acc\u001b[0mount acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m1\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Warning Message from server for B^^^p^o^o^l^B^^^D^e^a^l^R^u^n^B:Bond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList [(PoolConsol,4)]\n",
"\n"
],
"text/plain": [
"Warning Message from server for B^^^p^o^o^l^B^^^D^e^a^l^R^u^n^\u001b[1;92mB:B\u001b[0mond B is not paid off\n",
"Account acc01 has cash to be distributed\n",
"Oustanding pool cashflow hasn't been collected yetfromList \u001b[1m[\u001b[0m\u001b[1m(\u001b[0mPoolConsol,\u001b[1;36m4\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"runAssumptionMap = {\n",
" \"DealRunA\":[(\"call\",(\"poolBalance\",200))]\n",
" ,\"DealRunB\":[(\"call\",(\"poolBalance\",500))]\n",
"}\n",
"\n",
"poolAssumpMap = {\n",
" \"poolA\": (\"Pool\",(\"Mortgage\",{\"CDR\":0.01},None,None,None)\n",
" ,None\n",
" ,None),\n",
" \"poolB\": (\"Pool\",(\"Mortgage\",{\"CDR\":0.03},None,None,None)\n",
" ,None\n",
" ,None)\n",
"}\n",
"\n",
"r = localAPI.runByCombo({\"A\":test01,\"B\":test01}\n",
" ,runAssump= runAssumptionMap\n",
" ,poolAssump = poolAssumpMap\n",
" ,read=True\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "a680eb80",
"metadata": {},
"source": [
"access result via a tuple"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "04507bff",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dict_keys([('A', 'poolA', 'DealRunA'), ('A', 'poolA', 'DealRunB'), ('A', 'poolB', 'DealRunA'), ('A', 'poolB', 'DealRunB'), ('B', 'poolA', 'DealRunA'), ('B', 'poolA', 'DealRunB'), ('B', 'poolB', 'DealRunA'), ('B', 'poolB', 'DealRunB')])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r.keys()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "1b389e14",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" From | \n",
" To | \n",
" Comment | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 2022-06-20 | \n",
" Amortizing | \n",
" Called | \n",
" Call by triggers before waterfall distribution | \n",
"
\n",
" \n",
" | 1 | \n",
" 2021-04-01 | \n",
" PreClosing | \n",
" Amortizing | \n",
" By Deal Close | \n",
"
\n",
" \n",
" | 2 | \n",
" 2022-06-20 | \n",
" | \n",
" DealEnd | \n",
" Clean Up | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date From To \\\n",
"0 2022-06-20 Amortizing Called \n",
"1 2021-04-01 PreClosing Amortizing \n",
"2 2022-06-20 DealEnd \n",
"\n",
" Comment \n",
"0 Call by triggers before waterfall distribution \n",
"1 By Deal Close \n",
"2 Clean Up "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r[('A', 'poolB', 'DealRunB')]['result']['status']"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "eaadc880",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" From | \n",
" To | \n",
" Comment | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 2022-09-20 | \n",
" Amortizing | \n",
" Called | \n",
" Call by triggers before waterfall distribution | \n",
"
\n",
" \n",
" | 1 | \n",
" 2021-04-01 | \n",
" PreClosing | \n",
" Amortizing | \n",
" By Deal Close | \n",
"
\n",
" \n",
" | 2 | \n",
" 2022-09-20 | \n",
" | \n",
" DealEnd | \n",
" Clean Up | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date From To \\\n",
"0 2022-09-20 Amortizing Called \n",
"1 2021-04-01 PreClosing Amortizing \n",
"2 2022-09-20 DealEnd \n",
"\n",
" Comment \n",
"0 Call by triggers before waterfall distribution \n",
"1 By Deal Close \n",
"2 Clean Up "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r[('A', 'poolB', 'DealRunA')]['result']['status']"
]
},
{
"cell_type": "markdown",
"id": "e10a12b8",
"metadata": {},
"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": 5
}