IRR Example (continue)
In absbox, user can calculate irr of a tranche or (multiple tranches) for scenarios of:
During the waterfall distribution, user want to pay up to x% IRR to a bond (which makes IRR of the bond close to that threshold.
Using IRR from the formula, like inspect the current IRR of the bond, or use the IRR in a
condition
Init
from absbox import examples,API,EnginePath
localAPI = API(EnginePath.DEV, check=False)
Connecting engine server -> https://absbox.org/api/dev
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/latest/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.4
from absbox import Generic
Irr02 = Generic(
"IRR Case 02"
,{"cutoff":"2021-03-01","closing":"2021-04-01","firstPay":"2021-06-20"
,"payFreq":["DayOfMonth",20],"poolFreq":"MonthFirst","stated":"2030-01-01"}
,{'assets':[["Mortgage"
,{"originBalance":2200,"originRate":["fix",0.045],"originTerm":20
,"freq":"Monthly","type":"Level","originDate":"2021-02-01"}
,{"currentBalance":2200
,"currentRate":0.08
,"remainTerm":20
,"status":"current"}]]}
,(("acc01",{"balance":0}),)
,(("A1",{"balance":1000
,"rate":0.07
,"originBalance":1000
,"originRate":0.07
,"startDate":"2021-04-01"
,"rateType":{"Fixed":0.08}
,"bondType":{"Sequential":None}})
,("B",{"balance":1000
,"rate":0.0
,"originBalance":1000
,"originRate":0.07
,"startDate":"2021-04-01"
,"rateType":{"Fixed":0.00}
,"bondType":{"Equity":None}
,"stmt":[["2021-04-01",0,0,0,0,-1000,0,0,None,""],]
}))
,(("incentiveFee",{"type":{"fixFee":100},"feeStart":"2021-04-01"}),)
,{"amortizing":[
["accrueAndPayInt","acc01",["A1"]]
,["payPrin","acc01",["A1"]]
,["payPrin","acc01",["B"]]
#,["payIntResidual","acc01","B",{"limit":("ds",("floorWithZero",("amountForTargetIrr",0.11,"B")))}]
,["payIntResidual","acc01","B",{"limit":("ds",("floorWithZero",("amountForTargetIrr",0.10,"B")))}]
,["payFee","acc01",['incentiveFee',]]
,["payFeeResidual","acc01","incentiveFee"]
]}
,[["CollectedInterest","acc01"]
,["CollectedPrincipal","acc01"]
,["CollectedPrepayment","acc01"]
,["CollectedRecoveries","acc01"]]
,None
,None
,None
,None
,("PreClosing","Amortizing")
)
It says , pay out cash from account acc01 as a residual yield ( which won’t be constrainted to interest due ) to the bond B, by amount limited to a cap , which is the amount will make irr of bond B equal to 10%
["payIntResidual","acc01","B",{"limit":("ds",("floorWithZero",("amountForTargetIrr",0.10,"B")))}]
adding a
floorWithZero, because theamountForTargetIrrmay return negative
Inspect the IRR changes of bond
r0 = localAPI.run(Irr02
,poolAssump=("Pool",("Mortgage",{"CDRPadding":[0.01,0.02]},{"CPR":0.02},{"Rate":0.1,"Lag":5},None)
,None
,None)
,runAssump = [
("inspect",["MonthEnd",("irrOfBond","B")]
)
]
,read=True
)
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/latest/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(
r0['result']['inspect']['<IrrOfBond:B>']
| <IrrOfBond:B> | |
|---|---|
| Date | |
| 2021-03-01 | -1.000000 |
| 2021-03-31 | -1.000000 |
| 2021-04-30 | -1.000000 |
| 2021-05-31 | -1.000000 |
| 2021-06-30 | -1.000000 |
| 2021-07-31 | -1.000000 |
| 2021-08-31 | -1.000000 |
| 2021-09-30 | -1.000000 |
| 2021-10-31 | -1.000000 |
| 2021-11-30 | -0.991550 |
| 2021-12-31 | -0.924962 |
| 2022-01-31 | -0.819225 |
| 2022-02-28 | -0.691808 |
| 2022-03-31 | -0.556005 |
| 2022-04-30 | -0.418251 |
| 2022-05-31 | -0.284275 |
| 2022-06-30 | -0.156962 |
| 2022-07-31 | -0.038095 |
| 2022-08-31 | 0.071716 |
| 2022-09-30 | 0.099997 |
| 2022-10-31 | 0.099997 |
| 2022-11-30 | 0.099997 |
| 2022-12-31 | 0.099997 |
| 2023-01-31 | 0.099997 |
| 2023-02-28 | 0.099997 |