Skip to content

Commit 1c12eaa

Browse files
committed
update IC test doc
1 parent 4433eb8 commit 1c12eaa

File tree

4 files changed

+53
-37
lines changed

4 files changed

+53
-37
lines changed

absbox/local/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
,"平均比例","irrOfBond"])
110110
intLikeFormula = set(["borrowerNumber", "monthsTillMaturity", "periodNum"])
111111
boolLikeFormula = set(["trigger", "事件", "isMostSenior", "最优先", "isPaidOff","清偿完毕","rateTest","allTest","anyTest","比率测试","任一测试","所有测试"
112-
"isOutstanding"])
112+
"isOutstanding","isAnyOutstanding"])
113113

114114
bookDirection = {"Credit":"Credit" ,"Debit":"Debit"
115115
,"借方":"Debit" ,"贷方":"Credit"

docs/source/modeling.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ Pool
269269
.. versionadded:: 0.24.1
270270
* ``("schedulePoolValuation", <pricing method>, <pool name1>, <pool name2>..)`` -> get valuation on schedule cashflow from specific pool or all pools with :ref:`Pricing Method`
271271

272+
.. versionadded:: 0.52.3
273+
* ``(poolAccruedInterest, )`` -> get accrued interest of the pool
274+
272275
Accounts
273276
"""""""""""""
274277
* ``("accountBalance",)`` -> sum of all account balance
@@ -365,7 +368,8 @@ Bool Type
365368
.. versionadded:: 0.28.10
366369
* ``("isOutstanding", "A", "B", "C"...)`` -> True if all "A","B","C" bonds are ALL active
367370

368-
371+
.. versionadded:: 0.52.3
372+
* ``("isAnyOutstanding", "A", "B", "C"...)`` -> True if any of "A","B","C" bonds are active
369373

370374
Or `formula` can be an arithmetic calculation on itselfies.
371375

@@ -3469,7 +3473,9 @@ examples:
34693473
source of funds:
34703474
* :ref:`Accounts`
34713475
* :ref:`Liquidity Provider`
3472-
* a combination of above
3476+
* a combination of abovef
3477+
.. versionadded:: 0.52.3
3478+
* with a :ref:`Condition` to trigger the support ( if the test return True, then the support will be triggered)
34733479
34743480
syntax:
34753481
``["payFee", {Account}, [<Fee>], {'support':<supports>}]``
@@ -3483,10 +3489,14 @@ examples:
34833489
* supported by liquidity provider:
34843490
34853491
* ``["facility","liquidity provider name"]``
3486-
* supported by mix (draw via sequence)
3492+
* supported by mix (draw funds sequentially)
34873493
34883494
* ``["support" ,["account","accountName1"] ,["facility","liquidity provider name"] ,["account","accountName2"]]``
34893495
3496+
* conditionally support
3497+
3498+
* ``["withCondition", <Condition>, <support>]``
3499+
34903500
<ordering>
34913501
""""""""""""""""
34923502

docs/source/nbsample/IC_Test.ipynb

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 1,
13+
"execution_count": null,
1414
"id": "b8d9117c",
1515
"metadata": {},
1616
"outputs": [],
1717
"source": [
18-
"%load_ext autoreload\n",
19-
"%autoreload 2\n",
20-
"\n",
2118
"import pandas as pd\n",
22-
"\n",
2319
"pd.set_option('display.max_rows', None)"
2420
]
2521
},
@@ -73,10 +69,12 @@
7369
"bond_ICs = [(\"A\",(\"A1\",),1.05),(\"B\",(\"A1\",\"B\"),1.03)]\n",
7470
"\n",
7571
"IC_triggers = {f\"IC_{tName}\":\n",
76-
" {\"condition\":((\"/\",(\"accountBalance\",\"intAcc\")\n",
77-
" ,(\"bondDueInt\",*b))\n",
78-
" ,\"<\"\n",
79-
" ,threshold)\n",
72+
" {\"condition\":[\"all\"\n",
73+
" ,[(\"bondDueInt\",*b),\">\",0]\n",
74+
" ,[(\"/\", (\"accountBalance\",\"intAcc\"),(\"bondDueInt\",*b))\n",
75+
" ,\"<\"\n",
76+
" ,threshold]\n",
77+
" ]\n",
8078
" ,\"effects\":None\n",
8179
" ,\"status\":False\n",
8280
" ,\"curable\":True}\n",
@@ -86,12 +84,10 @@
8684
"OC_triggerNames = list(OC_triggers.keys())\n",
8785
"\n",
8886
"\n",
89-
"\n",
90-
"\n",
9187
"CLO_sample = Generic(\n",
9288
" \"CLO_sample\"\n",
9389
" ,{\"cutoff\":\"2021-03-01\",\"closing\":\"2021-06-15\",\"firstPay\":\"2021-07-26\"\n",
94-
" ,\"payFreq\":[\"DayOfMonth\",20],\"poolFreq\":\"MonthEnd\",\"stated\":\"2030-01-01\"}\n",
90+
" ,\"payFreq\":[\"DayOfMonth\",20],\"poolFreq\":\"MonthEnd\",\"stated\":\"2030-01-01\"}\n",
9591
" ,{'assets':[[\"Mortgage\"\n",
9692
" ,{\"originBalance\":2200,\"originRate\":[\"fix\",0.045],\"originTerm\":30\n",
9793
" ,\"freq\":\"Monthly\",\"type\":\"Level\",\"originDate\":\"2021-02-01\"}\n",
@@ -107,36 +103,36 @@
107103
" ,{\"amortizing\":[\n",
108104
" # intereset waterfall\n",
109105
" # accrue and pay senior fee \n",
110-
" [\"calcAndPayFee\",\"intAcc\",['seniorFee']]\n",
106+
" [\"calcAndPayFee\",\"intAcc\",['seniorFee']]\n",
111107
" # accrue interest for both bonds (NO payment) \n",
112-
" ,[\"calcInt\",\"A1\",\"B\"]\n",
108+
" ,[\"calcInt\",\"A1\",\"B\"]\n",
113109
" # calculate OC and IC test\n",
114-
" ,['runTriggers',*IC_triggerNames]\n",
110+
" ,['runTriggers',*(IC_triggerNames)]\n",
115111
" # payout interest of A1 \n",
116-
" ,[\"payInt\",\"intAcc\",[\"A1\"]]\n",
112+
" ,[\"payInt\",\"intAcc\",[\"A1\"]]\n",
117113
" # if all IC test is passing \n",
118-
" ,[\"IfElse\",[(\"trigger\",\"InDistribution\", \"IC_A1\"),False],\n",
114+
" ,[\"IfElse\",[(\"trigger\",\"InDistribution\", \"IC_A1\"),False],\n",
119115
" # if passing\n",
120116
" [[\"payInt\",\"intAcc\",[\"B\"]]\n",
121-
" ,[\"calcAndPayFee\",\"intAcc\",['subFee']]\n",
122-
" ,[\"payIntResidual\",\"intAcc\",\"E\"]]\n",
117+
" ,[\"calcAndPayFee\",\"intAcc\",['subFee']]\n",
118+
" ,[\"payIntResidual\",\"intAcc\",\"E\"]]\n",
123119
" # if failing, redemption senior to satisfy IC\n",
124120
" ,[[\"payPrin\",\"intAcc\",[\"A1\"]\n",
125-
" ,{\"limit\":{\"formula\":(\"bondBalance\",\"A1\")}}\n",
126-
" ]\n",
127-
" # update IC test again\n",
128-
" ,['runTriggers',*IC_triggerNames]\n",
129-
" # if IC test is passing\n",
121+
" ,{\"limit\":{\"formula\":(\"bondBalance\",\"A1\")}}\n",
122+
" ]\n",
123+
" # update IC test again\n",
124+
" #,['runTriggers',*IC_triggerNames]\n",
125+
" # if IC test is passing\n",
130126
" ,[\"If\",[(\"trigger\",\"InDistribution\", \"IC_A1\"), False],\n",
131127
" # pay interest of B and residual to E\n",
132128
" [\"payInt\",\"intAcc\",[\"B\"]],\n",
133129
" [\"calcAndPayFee\",\"intAcc\",['subFee']],\n",
134130
" [\"payIntResidual\",\"intAcc\",\"E\"]]\n",
135131
" ]]\n",
136132
" # principal waterfall\n",
137-
" ,[\"payPrinBySeq\",\"prinAcc\",[\"A1\",\"B\"]]\n",
138-
" ,[\"payPrinResidual\",\"prinAcc\",[\"E\"]]\n",
139-
" ]}\n",
133+
" ,[\"payPrinBySeq\",\"prinAcc\",[\"A1\",\"B\"]]\n",
134+
" ,[\"payPrinResidual\",\"prinAcc\",[\"E\"]]\n",
135+
" ]}\n",
140136
" ,[[\"CollectedInterest\",\"intAcc\"]\n",
141137
" ,[\"CollectedPrincipal\",\"prinAcc\"]\n",
142138
" ,[\"CollectedPrepayment\",\"prinAcc\"]\n",
@@ -151,7 +147,7 @@
151147
},
152148
{
153149
"cell_type": "code",
154-
"execution_count": 64,
150+
"execution_count": null,
155151
"id": "79adf3c9",
156152
"metadata": {},
157153
"outputs": [
@@ -209,7 +205,7 @@
209205
},
210206
{
211207
"cell_type": "code",
212-
"execution_count": 65,
208+
"execution_count": null,
213209
"id": "f748d10e",
214210
"metadata": {},
215211
"outputs": [
@@ -463,7 +459,17 @@
463459
}
464460
],
465461
"source": [
466-
"r['triggers']['InWF']['IC_A1']"
462+
"r['triggers']['InWF']['IC_A1'].head(20)"
463+
]
464+
},
465+
{
466+
"cell_type": "code",
467+
"execution_count": null,
468+
"id": "ede47df5",
469+
"metadata": {},
470+
"outputs": [],
471+
"source": [
472+
"r['triggers']['InWF']['IC_A1'].head(20).loc['2021-07-26'].memo"
467473
]
468474
},
469475
{
@@ -873,7 +879,7 @@
873879
],
874880
"metadata": {
875881
"kernelspec": {
876-
"display_name": "Python 3 (ipykernel)",
882+
"display_name": "AbsBox (3.13.3)",
877883
"language": "python",
878884
"name": "python3"
879885
},
@@ -887,7 +893,7 @@
887893
"name": "python",
888894
"nbconvert_exporter": "python",
889895
"pygments_lexer": "ipython3",
890-
"version": "3.11.9"
896+
"version": "3.13.3"
891897
}
892898
},
893899
"nbformat": 4,

docs/source/nbsample/MultiIntBond.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@
674674
"name": "python",
675675
"nbconvert_exporter": "python",
676676
"pygments_lexer": "ipython3",
677-
"version": "3.11.2"
677+
"version": "3.13.3"
678678
}
679679
},
680680
"nbformat": 4,

0 commit comments

Comments
 (0)