Пример #1
0
def main():

    # Test case: Test the ABS model with a single process and 1500 loans on pro rata mode
    # Assets are from 'Loans.csv'
    # Liabilities:
    #   tranches.addTranche('StandardTranche', '0.8', '0.05', '1')
    #   tranches.addTranche('StandardTranche', '0.2', '0.08', '2')
    # Run the Waterfall 1 time to get a CSV output of the transactions
    #   on 'liabilities_prorata_1500loans.csv'
    ###############################################
    # Set logging level
    logging.getLogger().setLevel(logging.DEBUG)

    ###############################################
    loans1500 = LoanPool(
        loansImportCSV('MA4176_31418DUA8_COLLAT_ISSUANCE.csv'))
    tranches = StructuredSecurities(loans1500.totalPrincipal())
    tranches.addTranche('StandardTranche', '0.5', '0.02500', '1')
    tranches.addTranche('StandardTranche', '0.5', '0.03125', '2')
    print(f'Pro Rata mode:')
    tranches.setMode('Pro Rata')

    ledger, tranchesMetrics = simulateWaterfall(loans1500, tranches, 1)
    spvExportCSV(ledger, 'liabilities_prorata_FannieMaeData.csv')
    for tranche in tranches.tranches:
        print(f'{tranche}\n'
              f' IRR = {tranche.r}\n'
              f' DIRR = {tranche.dirr}\n'
              f' DIRR(letter) = {tranche.dirrLetter}\n'
              f' AL = {tranche.al}')
def main():

    # Test case: Test the ABS model with a single process and 1500 loans on sequential mode
    # Assets are from 'Loans.csv'
    # Liabilities:
    #   tranches.addTranche('StandardTranche', '0.8', '0.05', '1')
    #   tranches.addTranche('StandardTranche', '0.2', '0.08', '2')
    # Run the Waterfall 1 time to get a CSV output of the transactions
    #   on 'liabilities_sequential_1500loans.csv'
    ###############################################
    # Set logging level
    logging.getLogger().setLevel(logging.DEBUG)

    ###############################################
    loans1500 = LoanPool(loansImportCSV('Loans.csv'))
    tranches = StructuredSecurities(loans1500.totalPrincipal())
    tranches.addTranche('StandardTranche', '0.8', '0.05', '1')
    tranches.addTranche('StandardTranche', '0.2', '0.08', '2')
    tranches.setMode('Sequential')

    ledger, tranchesMetrics = simulateWaterfall(loans1500, tranches, 1)
    spvExportCSV(ledger, 'liabilities_sequential_1500loans.csv')
    for tranche in tranches.tranches:
        print(f'{tranche}\n'
              f' IRR = {tranche.r}\n'
              f' DIRR = {tranche.dirr}\n'
              f' DIRR(letter) = {tranche.dirrLetter}\n'
              f' AL = {tranche.al}')
def main():

    # Test case: Test the ABS model with Monte Carlo on 1500 loans, on multiprocessing, sequential mode
    # Assets are from Loans.csv
    # Liabilities: originally start with these below tranches
    #   tranches.addTranche('StandardTranche', '0.8', '0.05', '1')
    #   tranches.addTranche('StandardTranche', '0.2', '0.08', '2')
    # Optimize tranches' rates based on a yield curve to get diff = 50 bps or less.
    # Print optimized rate on screen and run the Waterfall 1 time to get a CSV output of the transactions
    #   on 'liabilities_sequential_montecarlo_multiprocessing_1500loans.csv'
    ###############################################
    # Set logging level
    logging.getLogger().setLevel(logging.DEBUG)

    random.seed(1)
    ###############################################
    loansFannie = LoanPool(
        loansImportCSV('MA4176_31418DUA8_COLLAT_ISSUANCE.csv'))
    tranches = StructuredSecurities(loansFannie.totalPrincipal())
    tranches.addTranche('StandardTranche', '0.5', '0.02500', '1')
    tranches.addTranche('StandardTranche', '0.5', '0.03125', '2')
    tranches.setMode('Sequential')

    newTrancheRate = runMonte(loansFannie, tranches, 0.005, 2000, 20)
    print(f'My new tranche rate is = {newTrancheRate}')

    # Run the Waterfall once to generate CSV output of transactions.
    tranches = StructuredSecurities(loansFannie.totalPrincipal())
    tranches.addTranche('StandardTranche', '0.5', newTrancheRate[0], '1')
    tranches.addTranche('StandardTranche', '0.5', newTrancheRate[1], '2')
    tranches.setMode('Sequential')
    ledger, tranchesMetrics = simulateWaterfall(loansFannie, tranches, 1)
    spvExportCSV(
        ledger,
        'liabilities_sequential_montecarlo_multiprocessing_FannieMae.csv')
    for tranche in tranches.tranches:
        print(f'{tranche}\n'
              f' IRR = {tranche.r}\n'
              f' DIRR = {tranche.dirr}\n'
              f' DIRR(letter) = {tranche.dirrLetter}\n'
              f' AL = {tranche.al}')
Пример #4
0
def main():

    # Test case: Test the ABS model with Monte Carlo on 1500 loans on single process, pro rata mode
    # Assets are from Loans.csv
    # Liabilities: originally start with these below tranches
    #   tranches.addTranche('StandardTranche', '0.8', '0.05', '1')
    #   tranches.addTranche('StandardTranche', '0.2', '0.08', '2')
    # nsim = 10
    # numProcesses = 1
    # Optimize tranches' rates based on a yield curve to get diff = 1000 bps or less.
    # Print optimized rate on screen and run the Waterfall 1 time to get a CSV output of the transactions
    #   on 'liabilities_prorata_montecarlo_singleprocess_1500loans.csv'
    ###############################################
    # Set logging level
    logging.getLogger().setLevel(logging.DEBUG)

    ###############################################
    loans1500 = LoanPool(loansImportCSV('Loans.csv'))
    tranches = StructuredSecurities(loans1500.totalPrincipal())
    tranches.addTranche('StandardTranche', '0.8', '0.05', '1')
    tranches.addTranche('StandardTranche', '0.2', '0.08', '2')
    tranches.setMode('Pro Rata')

    newTrancheRate = runMonte(loans1500, tranches, 0.1, 10, 1)
    print(f'My new tranche rate is = {newTrancheRate}')

    # Run the Waterfall once to generate CSV output of transactions.
    tranches = StructuredSecurities(loans1500.totalPrincipal())
    tranches.addTranche('StandardTranche', '0.8', newTrancheRate[0], '1')
    tranches.addTranche('StandardTranche', '0.2', newTrancheRate[1], '2')
    tranches.setMode('Pro Rata')
    ledger, tranchesMetrics = simulateWaterfall(loans1500, tranches, 1)
    spvExportCSV(ledger, 'liabilities_prorata_montecarlo_singleprocess_1500loans.csv')
    for tranche in tranches.tranches:
        print(f'{tranche}\n'
              f' IRR = {tranche.r}\n'
              f' DIRR = {tranche.dirr}\n'
              f' DIRR(letter) = {tranche.dirrLetter}\n'
              f' AL = {tranche.al}')