Three ways to run deal
from absbox import API,EnginePath
localAPI = API(EnginePath.DEV, lang='english', check=False)
Connecting engine server -> https://absbox.org/api/dev
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/stable/lib/python3.11/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
warnings.warn(
✅Connected, local lib:0.52.3, server:0.52.3
Single Run
from absbox import examples
myAssumption = ("Pool",("Mortgage",{"CDR":0.01},None,None,None)
,None
,None)
r = localAPI.run(examples.test01
,poolAssump=myAssumption
,read=True)
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/stable/lib/python3.11/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
warnings.warn(
the result r returned by API function run().
Scenario Sensitivity Run
User can build a pool performance map and call the API function runByScenarios
myAssumption = ("Pool",("Mortgage",{"CDR":0.01},None,None,None)
,None
,None)
myAssumption2 = ("Pool",("Mortgage",None,{"CPR":0.01},None,None)
,None
,None)
r = localAPI.runByScenarios(examples.test01
,poolAssump={"00":myAssumption
,"stressed":myAssumption2}
,read=True)
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/stable/lib/python3.11/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
warnings.warn(
The result r is a dict whose keys came fromt he pool assumpiton map
r['00']['pool']['flow']['PoolConsol'].head()
| Balance | Principal | Interest | Prepayment | Default | Recovery | Loss | WAC | BorrowerNum | PrepayPenalty | CumPrincipal | CumPrepay | CumDelinq | CumDefault | CumRecovery | CumLoss | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Date | ||||||||||||||||
| 2021-04-01 | 1989.69 | 206.84 | 28.60 | 0 | 3.47 | 0 | 3.47 | 0.08 | None | None | 206.84 | 0 | 0 | 3.47 | 0 | 3.47 |
| 2021-05-01 | 1883.73 | 104.32 | 13.25 | 0 | 1.64 | 0 | 1.64 | 0.08 | None | None | 311.16 | 0 | 0 | 5.11 | 0 | 5.11 |
| 2021-06-01 | 1777.20 | 104.93 | 12.54 | 0 | 1.60 | 0 | 1.60 | 0.08 | None | None | 416.09 | 0 | 0 | 6.71 | 0 | 6.71 |
| 2021-07-01 | 1670.20 | 105.54 | 11.83 | 0 | 1.46 | 0 | 1.46 | 0.08 | None | None | 521.63 | 0 | 0 | 8.17 | 0 | 8.17 |
| 2021-08-01 | 1562.63 | 106.15 | 11.12 | 0 | 1.42 | 0 | 1.42 | 0.08 | None | None | 627.78 | 0 | 0 | 9.59 | 0 | 9.59 |
r['stressed']['pool']['flow']['PoolConsol'].head()
| Balance | Principal | Interest | Prepayment | Default | Recovery | Loss | WAC | BorrowerNum | PrepayPenalty | CumPrincipal | CumPrepay | CumDelinq | CumDefault | CumRecovery | CumLoss | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Date | ||||||||||||||||
| 2021-04-01 | 1989.69 | 206.84 | 28.60 | 3.47 | 0 | 0 | 0 | 0.08 | None | None | 206.84 | 3.47 | 0 | 0 | 0 | 0 |
| 2021-05-01 | 1883.73 | 104.32 | 13.25 | 1.64 | 0 | 0 | 0 | 0.08 | None | None | 311.16 | 5.11 | 0 | 0 | 0 | 0 |
| 2021-06-01 | 1777.20 | 104.93 | 12.54 | 1.60 | 0 | 0 | 0 | 0.08 | None | None | 416.09 | 6.71 | 0 | 0 | 0 | 0 |
| 2021-07-01 | 1670.20 | 105.54 | 11.83 | 1.46 | 0 | 0 | 0 | 0.08 | None | None | 521.63 | 8.17 | 0 | 0 | 0 | 0 |
| 2021-08-01 | 1562.63 | 106.15 | 11.12 | 1.42 | 0 | 0 | 0 | 0.08 | None | None | 627.78 | 9.59 | 0 | 0 | 0 | 0 |
Structure Senstivity Run
To run mulitple deals with same pool/deal run assumption , user can call runStructs() from the API.
The function will return the result as a map.
r = localAPI.runStructs({"A":examples.test01
,"B":examples.test02}
,read=True)
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/stable/lib/python3.11/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
warnings.warn(
r['A']['bonds']['A1'].head()
| balance | interest | principal | rate | cash | intDue | intOverInt | factor | memo | |
|---|---|---|---|---|---|---|---|---|---|
| date | |||||||||
| 2021-06-20 | 543.90 | 15.34 | 456.10 | 0.07 | 471.44 | 0 | 0 | 0.54390 | [<PayInt:A1>, <PayPrin:A1>] |
| 2021-07-20 | 429.17 | 3.12 | 114.73 | 0.07 | 117.85 | 0 | 0 | 0.42917 | [<PayInt:A1>, <PayPrin:A1>] |
| 2021-08-20 | 313.86 | 2.55 | 115.31 | 0.07 | 117.86 | 0 | 0 | 0.31386 | [<PayInt:A1>, <PayPrin:A1>] |
| 2021-09-20 | 197.87 | 1.86 | 115.99 | 0.07 | 117.85 | 0 | 0 | 0.19787 | [<PayInt:A1>, <PayPrin:A1>] |
| 2021-10-20 | 81.15 | 1.13 | 116.72 | 0.07 | 117.85 | 0 | 0 | 0.08115 | [<PayInt:A1>, <PayPrin:A1>] |
r['B']['bonds']['A1'].head()
| balance | interest | principal | rate | cash | intDue | intOverInt | factor | memo | |
|---|---|---|---|---|---|---|---|---|---|
| date | |||||||||
| 2021-06-20 | 340.83 | 12.27 | 459.17 | 0.07 | 471.44 | 0 | 0 | 0.34083 | [<PayInt:A1>, <PayPrin:A1>] |
| 2021-07-20 | 224.94 | 1.96 | 115.89 | 0.07 | 117.85 | 0 | 0 | 0.22494 | [<PayInt:A1>, <PayPrin:A1>] |
| 2021-08-20 | 108.41 | 1.33 | 116.53 | 0.07 | 117.86 | 0 | 0 | 0.10841 | [<PayInt:A1>, <PayPrin:A1>] |
| 2021-09-20 | 0.00 | 0.64 | 108.41 | 0.07 | 109.05 | 0 | 0 | 0.00000 | [<PayInt:A1>, <PayPrin:A1>] |