Skip to content

Commit

Permalink
add trigger with waterfall actions
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed Jun 8, 2024
1 parent 7fba807 commit 6abcedd
Show file tree
Hide file tree
Showing 7 changed files with 336 additions and 7 deletions.
2 changes: 1 addition & 1 deletion absbox/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .baseCase import test01,test02,test03,test04,test05
from .mixAssetType import mixedAsset_test01
from .triggerCase import trigger01,trigger02,trigger03,defautlRollingRateTrigger
from .triggerCase import trigger01,trigger02,trigger03,defautlRollingRateTrigger,trigger04
56 changes: 56 additions & 0 deletions absbox/examples/triggerCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,59 @@
,{"AfterCollect": defautlRollingRateTrigger}
,"Amortizing"
)


trigger04 = Generic(
"Trigger with waterfall action"
,{"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":"2020-01-03"
,"rateType":{"Fixed":0.08}
,"bondType":{"Sequential":None}})
,("B",{"balance":1000
,"rate":0.0
,"originBalance":1000
,"originRate":0.07
,"startDate":"2020-01-03"
,"rateType":{"Fixed":0.00}
,"bondType":{"Equity":None}
}))
,tuple()
,{"amortizing":[
["accrueAndPayInt","acc01",["A1"]]
,["payPrin","acc01",["A1"]]
,["payPrin","acc01",["B"]]
,["payIntResidual","acc01","B"]
]}
,[["CollectedInterest","acc01"]
,["CollectedPrincipal","acc01"]
,["CollectedPrepayment","acc01"]
,["CollectedRecoveries","acc01"]]
,None
,None
,None
,{
"AfterCollect":
{"poolDef":
{"condition":[("cumPoolDefaultedBalance",),">",20]
,"effects":("actions"
,["calcInt", "A1"]
,["payInt","acc01",["A1"]]
)
,"status":False
,"curable":False}
}}
,("PreClosing","Amortizing")
)
7 changes: 3 additions & 4 deletions absbox/local/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@


def mapNone(x, v):
''' return a default value if x is None, other wise, return x '''
if x is None:
return v
else:
return x


def lmap(f, xs):
''' just make it looks more functional '''
return list(map(f, xs))


Expand All @@ -32,6 +34,7 @@ def mkTag(x: tuple | str) -> dict:


def filter_by_tags(xs: list, tags: list) -> list:
''' fiter a list of maps by tags'''
tags_set = set(tags)
return [x for x in xs if x['tag'] in tags_set]

Expand All @@ -53,19 +56,15 @@ def readTagStr(x: str) -> str:
def readTag(x: dict):
return f"<{x['tag']}:{','.join(x['contents'])}>"


def isDate(x):
return re.match(r"\d{4}\-\d{2}\-\d{2}", x)


def allList(xs):
return all([isinstance(x, list) for x in xs])


def mkTs(n, vs):
return mkTag((n, vs))


def mkTbl(n, vs):
return mkTag((n, vs))

Expand Down
4 changes: 4 additions & 0 deletions docs/source/analytics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ params:
* ``deal`` : a deal instance
* ``poolAssump`` : pool performance assumption, passing a map if run with multi scenaro mode
* ``runAssump`` : deal assumptions
* ``showWarning``: if `False`, client won't show warning messages, defualt is `True`
* ``read`` : if `True` , will try it best to parse the result into `DataFrame`
returns:
Expand All @@ -911,6 +912,9 @@ returns:
* ``pool``
* ``result``
* ``pricing``
* ``_deal``
* ``ledgers``
* ``agg_accounts``
.. image:: img/deal_cycle_flow.png
:width: 600
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
copyright = '2024, Xiaoyu Zhang'
author = 'Xiaoyu Zhang'

release = '0.26.0'
version = '0.26.0'
release = "0.28.4"
release = "0.28.4"

# -- General configuration

Expand Down
Loading

0 comments on commit 6abcedd

Please sign in to comment.