Skip to content

Commit

Permalink
enhance funding plan with extra params
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed Aug 28, 2024
1 parent d4fc409 commit 206d9f1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions absbox/local/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,19 @@ def mkRateAssumption(x):
case _ :
raise RuntimeError(f"Failed to match RateAssumption:{x}")

def mkFundingPlan(x:tuple):
# IssueBondEvent mPre bondName accountName Bond mFormula mFormula
match x:
case (d,p,bName,accName,bnd,mBal,mRate):
return [vDate(d), mkTag(("IssueBondEvent",[earlyReturnNone(mkPre,p),vStr(bName),vStr(accName)
,mkBnd(bnd["name"],bnd|{"startDate":vDate(d)})|{"tag":"Bond"}
,earlyReturnNone(mkDs,mBal)
,earlyReturnNone(mkDs,mRate)]))]
case (d,bName,accName,bnd):
return [vDate(d), mkTag(("IssueBondEvent",[None,vStr(bName),vStr(accName),mkBnd(bnd["name"],bnd|{"startDate":vDate(d)})|{"tag":"Bond"},None,None]))]
case _:
raise RuntimeError(f"Failed to match mkFundingPlan:{x}")


def mkNonPerfAssumps(r, xs:list) -> dict:
def translate(y) -> dict:
Expand Down Expand Up @@ -2072,10 +2085,7 @@ def translate(y) -> dict:
case ("makeWhole", d,spd,tbl):
return {"makeWholeWhen": [d,spd,tbl]}
case ("issueBond", *issuancePlan):
return {"issueBondSchedule": [ [vDate(d),[vStr(bGrpName)
,vStr(accName)
,mkBnd(bnd["name"],bnd|{"startDate":vDate(d)})|{"tag":"Bond"}]]
for (d,bGrpName,accName,bnd) in issuancePlan] }
return {"issueBondSchedule": [ mkFundingPlan(p) for p in issuancePlan] }
match xs:
case None:
return {}
Expand Down

0 comments on commit 206d9f1

Please sign in to comment.