def get_actual_cashflows(X, X_int_rate, X_compound_rate, date_range_length): ''' Generates actual cashflow for each loan, i.e. monthly payments multiplied by actual payment as fraction of installment and compounded to the maturity of the loan Parameters: X: Values pertaining to actual payment made. numpy array. X_int_rate: Interest rate paid by each loan in X, 1-dimensional. numpy array. X_compound_rate: Compounding rate for time value of money calculations, 1-dimensional. numpy array. date_range_length: Total length of calculation period, normally 36. integer. Returns: Actual cashflows, as a list of numbers indicating actual payments made. numpy array. ''' payout_actual = get_actual_payout(X, date_range_length) return get_cashflows(payout_actual, X_int_rate, X_compound_rate, date_range_length)
def get_expected_cashflows(self, X, X_int_rate, X_compound_rate, X_sub_grade, date_range_length): ''' Generates expected cashflow for each loan, i.e. monthly payments multiplied by probability of receiving that payment and compounded to the maturity of the loan. Parameters: X: Values pertaining to loan features, with n columns. numpy array. X_int_rate: Interest rate paid by each loan in X, 1-dimensional. numpy array. X_compound_rate: Compounding rate for time value of money calculations, 1-dimensional. numpy array. X_sub_grade: Sub-grade of each loan in X, 1-dimensional. numpy array. date_range_length: Total length of calculation period, normally 36. integer. Returns: Expected cashflow over the life of the loan. numpy array. ''' expected_payout = self.get_expected_payout(X, X_sub_grade) return get_cashflows(expected_payout, X_int_rate, X_compound_rate, date_range_length)