Skip to content

Commit c9b3219

Browse files
committed
ready for 0.50.2
1 parent 49eb7df commit c9b3219

26 files changed

+4119
-4468
lines changed

absbox/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def runPool(self, pool, poolAssump=None, rateAssump=None, read=True, debug=False
516516
else:
517517
return result
518518

519-
def runStructs(self, deals, poolAssump=None, nonPoolAssump=None, runAssump=None, read=True, debug=False) -> dict:
519+
def runStructs(self, deals, poolAssump=None, nonPoolAssump=None, runAssump=None, rtn=[], read=True, debug=False) -> dict:
520520
"""run multiple deals with same assumption
521521
522522
:param deals: a dict of deals
@@ -540,7 +540,8 @@ def runStructs(self, deals, poolAssump=None, nonPoolAssump=None, runAssump=None,
540540
_poolAssump = mkAssumpType(poolAssump) if poolAssump else None
541541
_nonPerfAssump = mkNonPerfAssumps({}, mapNone(nonPoolAssump,[]) + mapNone(runAssump,[]))
542542
req = json.dumps(mkTag(("MultiDealRunReq"
543-
,[ tz.valmap(lambda x:x.json, deals)
543+
,[rtn
544+
,tz.valmap(lambda x:x.json, deals)
544545
,_poolAssump
545546
,_nonPerfAssump]))
546547
,ensure_ascii=False)

absbox/local/component.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,35 +1619,37 @@ def mkAsset(x):
16191619
vInt(remainTerms),
16201620
mkAssetStatus(status)]))
16211621
case ["租赁", {"租金": rental, "初始期限": originTerm, "起始日": startDate, "调整":sut}
1622-
,{"当前余额":bal,"状态": status, "剩余期限": remainTerms}] \
1622+
,{"状态": status, "剩余期限": remainTerms}] \
16231623
| ["Lease", {"rental": rental, "stepUp":sut, "originTerm": originTerm, "originDate": startDate}
1624-
,{"currentBalance":bal, "status": status, "remainTerm": remainTerms}]:
1624+
,{"status": status, "remainTerm": remainTerms}]:
16251625
obligorInfo = getValWithKs(x[1],["obligor","借款人"], mapping=mkObligor)
16261626
_stepUpType = mkLeaseStepUp(sut)
1627+
mCurBalance = getValWithKs(x[2],["currentBalance","当前余额"], defaultReturn=0)
16271628
return mkTag(("StepUpLease"
16281629
, [{"originTerm": originTerm, "startDate": startDate, "originRental": mkLeaseCalc(rental), "obligor": obligorInfo} | mkTag("LeaseInfo")
16291630
, _stepUpType
1630-
, vNum(bal)
1631+
, vNum(mCurBalance)
16311632
, vInt(remainTerms)
16321633
, mkAssetStatus(status)]))
16331634

16341635
case ["租赁", {"租金": rental, "初始期限": originTerm, "起始日": startDate}
1635-
,{"当前余额": bal, "剩余期限": remainTerms,"状态": status}] \
1636+
,{"剩余期限": remainTerms,"状态": status}] \
16361637
| ["Lease", {"rental": rental, "originTerm": originTerm, "originDate": startDate}
1637-
, {"currentBalance": bal,"status": status, "remainTerm": remainTerms}]:
1638+
, {"status": status, "remainTerm": remainTerms}]:
16381639
obligorInfo = getValWithKs(x[1],["obligor","借款人"], mapping=mkObligor)
1640+
mCurBalance = getValWithKs(x[2],["currentBalance","当前余额"], defaultReturn=0)
16391641
return mkTag(("RegularLease"
16401642
, [{"originTerm": originTerm, "startDate": startDate, "originRental": mkLeaseCalc(rental)
16411643
,"obligor": obligorInfo} | mkTag("LeaseInfo")
1642-
, vNum(bal)
1644+
, vNum(mCurBalance)
16431645
, vInt(remainTerms)
16441646
, mkAssetStatus(status)]))
16451647

16461648
case ["固定资产",{"起始日":sd,"初始余额":ob,"初始期限":ot,"残值":rb,"周期":p,"摊销":ar,"产能":cap}
1647-
,{"剩余期限":rt,"余额":bal}] \
1649+
,{"剩余期限":rt,"当前余额":bal}] \
16481650
|["FixedAsset",{"start":sd,"originBalance":ob,"originTerm":ot,"residual":rb,"period":p,"amortize":ar
16491651
,"capacity":cap}
1650-
,{"remainTerm":rt,"balance":bal}]:
1652+
,{"remainTerm":rt,"currentBalance":bal}]:
16511653
return mkTag(("FixedAsset",[{"startDate":vDate(sd),"originBalance":vNum(ob),"originTerm":vInt(ot),"residualBalance":vNum(rb)
16521654
,"period":freqMap[p],"accRule":mkAccRule(ar)
16531655
,"capacity":mkCapacity(cap)} | mkTag("FixedAssetInfo")

docs/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
sphinx==5.3.0
22
sphinx_rtd_theme==1.1.1
3+
sphinx-autobuild
4+
standard-imghdr
35
readthedocs-sphinx-search==0.3.2
46
sphinxemoji
57
notebook
68
myst-nb
79
absbox
8-
pyxirr
910
toolz
1011
lenses
1112
dateparser
@@ -14,4 +15,4 @@ pandas
1415
python-dateutil
1516
sphinx_changelog
1617
pytest-notebook
17-
sphinxcontrib-googleanalytics
18+
sphinxcontrib-googleanalytics

docs/source/analytics.rst

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,16 +845,19 @@ cashflow projection will stop at the date specified.
845845
846846
.. versionadded:: 0.46.5
847847

848-
After 0.46.5, the stop run can be specified by a :ref:`Condition` which will be evaluated on each distribution date described by :ref:`DatePattern`.
848+
After 0.46.5, the stop run can be specified by a :ref:`Condition` which will be evaluated on each distribution date described by :ref:`DatePattern`. Any condition met will stop the projection.
849849

850850
.. code-block:: python
851851
852852
("stop", <DatePattern>, *<Condition>)
853853
854854
.. code-block:: python
855855
856-
# on each month end, the engine will evaluate two conditions, stop projection when ALL of them are met
857-
("stop", "MonthEnd", [">=","2022-01-01"], [("bondBalance","A1"),"<=",200])
856+
# on each month end, the engine will evaluate two conditions
857+
# , stop projection when ALL of them are met
858+
859+
("stop", "MonthEnd"
860+
, [">=","2022-01-01"], [("bondBalance","A1"),"<=",200])
858861
859862
860863
Project Expense
@@ -1451,6 +1454,9 @@ params:
14511454
* ``showWarning``: if `False`, client won't show warning messages, defualt is `True`
14521455
* ``read`` : if `True` , will try it best to parse the result into `DataFrame`
14531456
1457+
.. versionadded:: 0.50.0
1458+
* ``rtn`` : defaults to [], to get asset level cashflow pass ``["AssetLevelFlow"]``
1459+
14541460
returns:
14551461
* a map with keys of components like:
14561462
@@ -1463,6 +1469,8 @@ returns:
14631469
* ``_deal``
14641470
* ``ledgers``
14651471
* ``agg_accounts``
1472+
.. versionadded:: 0.50.0
1473+
* ``pool_outstanding``
14661474
14671475
.. image:: img/deal_cycle_flow.png
14681476
:width: 600
@@ -1692,6 +1700,12 @@ Cashflow Results
16921700
* - ``Ledger flow``
16931701
- if modeled
16941702
- r['ledgers']
1703+
* - ``Uncollected Pool flow``
1704+
- if any (after 0.50.0)
1705+
- r['pool_outstanding']
1706+
* - ``Asset Level flow``
1707+
- if any (after 0.50.0) and toggle on
1708+
- r['pool']['breakdown']
16951709
16961710
16971711
* the `run()` function will return a dict which with keys of components like `bonds` `fees` `accounts` `pool`
@@ -1787,6 +1801,8 @@ User have the option to view multiple accounts cashflow in a single dataframe,wi
17871801
Pool Cashflow
17881802
""""""""""""""""
17891803
1804+
Pool cashflow collected into SPV.
1805+
17901806
.. code-block:: python
17911807
17921808
r['pool']['flow'] # pool cashflow
@@ -1802,6 +1818,64 @@ The ``readPoolsCf`` function can be used to view multiple pool cashflow.
18021818
readPoolsCf(r['pool']['flow'])
18031819
18041820
1821+
Pool cashflow un-collected.
1822+
1823+
.. versionadded:: 0.50.0
1824+
1825+
.. code-block:: python
1826+
1827+
r['pool_outstanding']['flow'] # pool cashflow to be collected
1828+
1829+
Asset level cashflow
1830+
1831+
.. versionadded:: 0.50.0
1832+
1833+
.. code-block:: python
1834+
1835+
r = api.run(..., rtn=["AssetLevelFlow"], read=True)
1836+
1837+
r['pool']['breakdown'] # cashflow list with breakdown
1838+
r['pool_outstanding']['breakdown'] # cashflow list with breakdown
1839+
1840+
1841+
1842+
Non-Cashflow Results
1843+
^^^^^^^^^^^^^^^^^^^^^^^^^
1844+
1845+
``r['result']`` save the run result other than cashflow.
1846+
1847+
.. list-table:: Non Cashflow Results
1848+
:header-rows: 1
1849+
1850+
* - Response Component
1851+
- Condition
1852+
- Path
1853+
* - ``Deal Status flow``
1854+
- /
1855+
- r['result']['status']
1856+
* - ``Bond Summary``
1857+
- /
1858+
- r['result']['bonds']
1859+
* - ``Bond Pricing``
1860+
- if `pricing` in deal assumption
1861+
- r['pricing']
1862+
* - ``Variable Inspect``
1863+
- if `inspect` in deal assumption
1864+
- r['result']['inspect']
1865+
* - ``Variable Inspect``
1866+
- if `inspect` in deal waterfall
1867+
- r['result']['waterfallInspect']
1868+
* - ``Deal Run Logs``
1869+
- /
1870+
- r['result']['logs']
1871+
* - ``Waterfall Run``
1872+
- /
1873+
- r['result']['waterfall']
1874+
* - ``Financial Reports``
1875+
- if `reports` in deal assumption
1876+
- r['result']['report']
1877+
1878+
Bond Pricing
18051879
Non-Cashflow Results
18061880
^^^^^^^^^^^^^^^^^^^^^^^^^
18071881
@@ -2276,19 +2350,28 @@ Stress Default
22762350
syntax
22772351
``stressDefault``
22782352
2353+
.. versionadded:: 0.50.1
2354+
``("stressDefault", <min factor:float>, <max factor:float>)``
2355+
22792356
Stress Prepayment
22802357
It will stress the prepayment component in the pool performance assumption.
22812358
22822359
syntax
22832360
``stressPrepayment``
22842361
2362+
.. versionadded:: 0.50.1
2363+
``("stressPrepayment", <min factor:float>, <max factor:float>)``
2364+
22852365
22862366
Max Spread
22872367
It will increase the spread of bond.
22882368
22892369
syntax
22902370
``("maxSpread", <bondName>)``
22912371
2372+
.. versionadded:: 0.50.1
2373+
``("maxSpread", <min factor:float>, <max factor:float>)``
2374+
22922375
Split Balance
22932376
It will adjust balance distribution of two bonds.
22942377

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
copyright = '2025, Xiaoyu Zhang'
1010
author = 'Xiaoyu Zhang'
1111

12-
release = "0.44.0"
13-
release = "0.44.0"
12+
release = "0.50.1"
13+
release = "0.50.1"
1414

1515
# -- General configuration
1616

0 commit comments

Comments
 (0)