def __init__(self, tranche_list, tranche_principal, bond_spread, base_coupon_rate, rev_percentage, simulated_rates, maturity, tables_file, show_prints=False, show_plots=False): self.tranche_list = tranche_list self.tranche_principal = tranche_principal self.bond_spread = bond_spread self.rev_percentage = rev_percentage self.base_coupon_rate = base_coupon_rate self.simulated_rates = simulated_rates self.T = maturity #the input should be already in the form of Months self.show_prints = show_prints self.show_plots = show_plots self.tables_file = tables_file self.fi = fixed_income.FixedIncome() #Processed Values self.N = simulated_rates.shape[0] # Number of simulations self.regular_classes = self.tranche_list[:] if 'R' in self.regular_classes: #might be kept self.regular_classes.remove('R')
def __init__(self): self.fi = fixed_income.FixedIncome() home_dir = os.path.dirname('__file__') self.libor_data = self.libor_data_func() self.cap_master_df = self.cap_data_func() #----------------------------------------- # self.opti_params = self.opti_func() #uncomment this section out to run optimization # self.opti_kap = self.opti_params[0] # self.opti_vol = self.opti_params[1] #--------------------------------------------- self.opti_kap = 0.11631394289351267 #comment out hard coded values is using optimization self.opti_vol = 0.017245499818435216 self.cap_pricing_df = self.cap_pricing() self.theta = self.find_theta()
def __init__(self, start_date, first_payment_date, pool_interest_rate, pools_info, classes_info, principal_sequential_pay, accruals_sequential_pay, simulated_rates, tables_file, show_prints=False, show_plots=False): # Direct inputs self.start_date = datetime.strptime(start_date, "%m/%d/%Y") self.first_payment_date = datetime.strptime(first_payment_date, "%m/%d/%Y") self.pool_interest_rate = pool_interest_rate self.pools_info = pools_info self.classes_info = classes_info self.principal_sequential_pay = principal_sequential_pay self.accruals_sequential_pay = accruals_sequential_pay self.simulated_rates = simulated_rates self.show_prints = show_prints self.show_plots = show_plots self.tables_file = tables_file self.fi = fixed_income.FixedIncome() # Processed attributes self.maturity = np.max(self.pools_info['Term']) self.n_pools = self.pools_info.shape[0] self.classes = list(self.classes_info['REMIC Classes']) self.regular_classes = self.classes[:] self.regular_classes.remove('R') self.accrual_classes = list(self.accruals_sequential_pay.keys()) self.principal_classes = list( set(self.regular_classes) - set(self.accrual_classes)) self.pools_info['Original Balance'] = self.pools_info[ 'Original Balance'].astype(float) self.pools_info['WAC'] = self.pools_info['WAC'].astype(float) self.classes_info['Original Balance'] = self.classes_info[ 'Original Balance'].astype(float) self.classes_info['Class Coupon'] = self.classes_info[ 'Original Balance'].astype(float) self.classes_info.index = self.classes_info['REMIC Classes'] self.calculate_pool_groups_proportions()
def __init__(self, show_prints=False, show_plots=False): self.show_prints = show_prints self.show_plots = show_plots self.fi = fixed_income.FixedIncome()
def __init__(self, pool_origination_date, evaluation_date, pools_info, classes_info, principal_sequential_pay, accruals_sequential_pay, simulated_rates, tables_file, show_prints=False, show_plots=False): # Direct inputs self.pool_origination_date = datetime.strptime(pool_origination_date, "%m/%d/%Y") self.evaluation_date = datetime.strptime(evaluation_date, "%m/%d/%Y") self.pools_info = pools_info self.classes_info = classes_info self.principal_sequential_pay = principal_sequential_pay self.accruals_sequential_pay = accruals_sequential_pay self.simulated_rates_cont = simulated_rates self.simulated_rates_APR = 12 * (np.exp(simulated_rates * 1 / 12) - 1) * 100 # Monthly APR in % self.show_prints = show_prints self.show_plots = show_plots self.tables_file = tables_file self.fi = fixed_income.FixedIncome() # Processed attributes self.maturity = np.max(self.pools_info['Term']) self.T = min( self.maturity + 1, simulated_rates.shape[1]) # Months remaining counting month 0 self.N = simulated_rates.shape[0] # Number of simulations self.evaluation_lag = (12 * self.evaluation_date.year + self.evaluation_date.month) - ( 12 * self.pool_origination_date.year + self.pool_origination_date.month) self.n_pools = self.pools_info.shape[0] self.classes = list(self.classes_info['REMIC Classes']) self.classes_ordered = principal_sequential_pay['1'] self.regular_classes = self.classes[:] if 'R' in self.regular_classes: self.regular_classes.remove('R') self.accrual_classes = list(self.accruals_sequential_pay.keys()) self.principal_classes = list( set(self.regular_classes) - set(self.accrual_classes)) self.pools_info.index = self.pools_info['Pool ID'] self.pools_info['Balance'] = self.pools_info['Balance'].astype(float) self.pools_info['WAC'] = self.pools_info['WAC'].astype(float) self.pools_info['Spread'] = self.pools_info['Spread'].astype(float) self.pools_info['LOL Cap'] = self.pools_info['LOL Cap'].astype(float) self.pools_info['Periodic Cap'] = self.pools_info[ 'Periodic Cap'].astype(float) self.pools_info['LTV'] = self.pools_info['LTV'].astype(float) self.pool_frm_balance = self.pools_info.loc['FRM', 'Balance'] self.pool_frm_wac = self.pools_info.loc['FRM', 'WAC'] self.pool_frm_ltv = self.pools_info.loc['FRM', 'LTV'] self.pool_arm_balance = self.pools_info.loc['ARM', 'Balance'] self.pool_arm_spread = self.pools_info.loc['ARM', 'Spread'] self.pool_arm_lol_cap = self.pools_info.loc['ARM', 'LOL Cap'] self.pool_arm_periodic_cap = self.pools_info.loc['ARM', 'Periodic Cap'] self.pool_arm_ltv = self.pools_info.loc['ARM', 'LTV'] self.classes_info.index = self.classes_info['REMIC Classes'] self.classes_info['Balance'] = self.classes_info['Balance'].astype( float) self.classes_info['Spread'] = self.classes_info['Spread'].astype(float) self.calculate_ARM_simulated_rates()