Deal with multiple Asset Types

from absbox import API,EnginePath

localAPI = API(EnginePath.DEV, lang='english', check=False)
Connecting engine server -> https://absbox.org/api/dev
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/stable/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.3
from absbox.examples import mixedAsset_test01

import a mix-asset-type deal

Lets import test case , which has two pools ,PoolA , PoolB, which holds Morgage and Loan respectively

mixedAsset_test01.pool
{'PoolA': {'assets': [['Mortgage',
    {'originBalance': 2200,
     'originRate': ['fix', 0.045],
     'originTerm': 30,
     'freq': 'Monthly',
     'type': 'Level',
     'originDate': '2021-02-01'},
    {'currentBalance': 2200,
     'currentRate': 0.08,
     'remainTerm': 30,
     'status': 'current'}]]},
 'PoolB': {'assets': [['Loan',
    {'originBalance': 80000,
     'originRate': ['floater',
      0.045,
      {'index': 'SOFR3M', 'spread': 0.01, 'reset': 'QuarterEnd'}],
     'originTerm': 60,
     'freq': 'Monthly',
     'type': 'i_p',
     'originDate': '2021-02-01'},
    {'currentBalance': 65000,
     'currentRate': 0.06,
     'remainTerm': 60,
     'status': 'Current'}]]}}

Set assumption by Pool Name

r = localAPI.run(mixedAsset_test01
                 ,poolAssump = ("ByName"
                                ,{"PoolA":
                                      (("Mortgage",{"CDR":0.02} ,None, None, None)
                                       ,None
                                       ,None)
                                ,"PoolB":
                                  (("Loan",{"CDR":0.01} ,None, None, None)
                                   ,None
                                   ,None)}
                                )
                 ,runAssump = [("interest",("LIBOR6M",0.04)
                                           ,("SOFR3M",0.04))
                               ,("inspect",("MonthEnd",("poolBalance","PoolB"))
                                          ,("MonthEnd",("poolBalance","PoolA"))
                                )]
                 ,read=True)
/home/docs/checkouts/readthedocs.org/user_builds/absbox-doc/envs/stable/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(
Warning Message from server:Bond B is not paid off
Fee serviceFee is not paid off
Fee serviceFee2 is not paid off
Account acc02 has cash to be distributed

Get result via pool name

r['pool']['flow']['PoolA'].head()
Balance Principal Interest Prepayment Default Recovery Loss WAC BorrowerNum PrepayPenalty CumPrincipal CumPrepay CumDelinq CumDefault CumRecovery CumLoss
Date
2021-07-15 1847.71 135.10 25.99 0 6.59 0 6.59 0.08 None None 135.10 0 0 6.59 0 6.59
2021-07-31 1847.71 0.00 0.00 0 0.00 0 0.00 0.08 None None 135.10 0 0 6.59 0 6.59
2021-08-31 1776.50 68.05 12.29 0 3.16 0 3.16 0.08 None None 203.15 0 0 9.75 0 9.75
2021-09-30 1705.08 68.38 11.82 0 3.04 0 3.04 0.08 None None 271.53 0 0 12.79 0 12.79
2021-10-31 1633.53 68.73 11.34 0 2.82 0 2.82 0.08 None None 340.26 0 0 15.61 0 15.61
r['pool']['flow']['PoolB'].head()
Balance Principal Interest Prepayment Default Recovery Loss WAC CumPrincipal CumPrepay CumDelinq CumDefault CumRecovery CumLoss
Date
2021-07-15 64732.11 0.0 541.13 0 108.81 0 108.81 0.05 0.0 0 0 108.81 0 108.81
2021-07-31 64732.11 0.0 0.00 0 0.00 0 0.00 0.05 0.0 0 0 108.81 0 108.81
2021-08-31 64676.88 0.0 274.65 0 55.23 0 55.23 0.05 0.0 0 0 164.04 0 164.04
2021-09-30 64621.70 0.0 274.42 0 55.18 0 55.18 0.05 0.0 0 0 219.22 0 219.22
2021-10-31 64568.35 0.0 265.34 0 53.35 0 53.35 0.05 0.0 0 0 272.57 0 272.57