From 37f4719556b4e2c0ba915076dd49c17c4dbf8088 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Thu, 4 May 2017 17:39:10 -0400 Subject: [PATCH 1/6] Create get_economics in Scenario class --- bpfin/financials/scenario.py | 164 +++++++++++++++++++++-------------- 1 file changed, 97 insertions(+), 67 deletions(-) diff --git a/bpfin/financials/scenario.py b/bpfin/financials/scenario.py index c606285..677a5dc 100644 --- a/bpfin/financials/scenario.py +++ b/bpfin/financials/scenario.py @@ -1,22 +1,17 @@ import copy -# from bpfin.utilbills.bill_lib import form_bill_calendar from bpfin.financials.saving import Saving_Overview from bpfin.financials.loan import Loan_List from bpfin.tests.testdata import sample_data as db from bpfin.financials.financial_lib import Income_Statement_Table, Balance_Sheet_Table from bpfin.utilbills.bill_lib import form_bill_year, annualizing_projection +# may delete from here after sample built +from bpfin.financials.cash_balance import cash_balance class Scenario(): - def __init__(self, - analysis_date, - commission_date, - construction_cost, - bill_overview, - prior_annual_bill_table, - other_debt_service, - prior_income_statement_table, - prior_balance_sheet_table, + def __init__(self, analysis_date, commission_date, construction_cost, + bill_overview, prior_annual_bill_table, other_debt_service, + prior_income_statement_table, prior_balance_sheet_table, loan_input_list): """ other_debt_service (dict): dictionary of debt service values per year @@ -28,8 +23,10 @@ class Scenario(): self.prior_annual_bill_table = copy.deepcopy(prior_annual_bill_table) self.other_debt_service = copy.deepcopy(other_debt_service) - self.prior_income_statement_table = copy.deepcopy(prior_income_statement_table) - self.prior_balance_sheet_table = copy.deepcopy(prior_balance_sheet_table) + self.prior_income_statement_table = copy.deepcopy( + prior_income_statement_table) + self.prior_balance_sheet_table = copy.deepcopy( + prior_balance_sheet_table) self.post_income_statement_table = None self.post_balance_sheet_table = None @@ -38,16 +35,11 @@ class Scenario(): bill_overview=copy.deepcopy(bill_overview), prior_annual_bill_table=copy.deepcopy(prior_annual_bill_table), analysis_date=copy.deepcopy(analysis_date), - commissioning_date=copy.deepcopy(commission_date) - ) + commissioning_date=copy.deepcopy(commission_date)) self.scheduled_loan_list = None - def prelim_anlaysis(self, - prior_month_bill, - percent_saving_dict, - full_saving_dict, - growth_rate_flag, - req_dscr, + def prelim_anlaysis(self, prior_month_bill, percent_saving_dict, + full_saving_dict, growth_rate_flag, req_dscr, customer_preference): """ growth_rate_flag (float): indicating assumed growth rate, -2.0 == cagr, -1.0 == historical average @@ -61,22 +53,32 @@ class Scenario(): full_saving_dict=full_saving_dict) # generate post_saving income_statement_table object - post_annual_bill_table = copy.deepcopy(self.saving_overview.get_post_annual_bill_table()) - post_income_statement_table = copy.deepcopy(self.prior_income_statement_table) - post_income_statement_table.project(growth_rate_flag, self.analysis_date, post_annual_bill_table) + post_annual_bill_table = copy.deepcopy( + self.saving_overview.get_post_annual_bill_table()) + post_income_statement_table = copy.deepcopy( + self.prior_income_statement_table) + post_income_statement_table.project( + growth_rate_flag, self.analysis_date, post_annual_bill_table) self.post_income_statement_table = post_income_statement_table # generate post_saving balance_sheet_table object - post_saving_noi_dict = copy.deepcopy(self.post_income_statement_table.get_noi_dict()) - post_balance_sheet_table = copy.deepcopy(self.prior_balance_sheet_table) + post_saving_noi_dict = copy.deepcopy( + self.post_income_statement_table.get_noi_dict()) + post_balance_sheet_table = copy.deepcopy( + self.prior_balance_sheet_table) post_balance_sheet_table.project_balance_sheet( self.analysis_date, self.other_debt_service, post_saving_noi_dict) self.post_balance_sheet_table = post_balance_sheet_table # allocate loan and get loan schedules - first_year_saving = copy.deepcopy(self.saving_overview.get_total_first_year_saving()) - first_year_noi = copy.deepcopy(self.post_income_statement_table.get_first_year_noi(self.commission_date)) - first_year_cash = copy.deepcopy(self.post_balance_sheet_table.get_first_year_cash(self.commission_date)) + first_year_saving = copy.deepcopy( + self.saving_overview.get_total_first_year_saving()) + first_year_noi = copy.deepcopy( + self.post_income_statement_table.get_first_year_noi( + self.commission_date)) + first_year_cash = copy.deepcopy( + self.post_balance_sheet_table.get_first_year_cash( + self.commission_date)) # print('first year =', first_year_saving, first_year_noi, first_year_cash) # print(self.loan_list.loan_list[0].institute) @@ -93,14 +95,16 @@ class Scenario(): def get_post_energy_bill(self): proforma_year = form_bill_year(self.analysis_date['proforma_start'], self.analysis_date['proforma_duration']) - post_annual_bill_table = copy.deepcopy(self.saving_overview.get_post_annual_bill_table()) + post_annual_bill_table = copy.deepcopy( + self.saving_overview.get_post_annual_bill_table()) utility_type_list = ['electricity', 'gas', 'oil', 'water'] post_energy_bill = {} for year in proforma_year: current_total_energy_bill = 0 for utility_type in utility_type_list: - current_total_energy_bill += post_annual_bill_table[utility_type][year] + current_total_energy_bill += post_annual_bill_table[ + utility_type][year] post_energy_bill[year] = current_total_energy_bill return post_energy_bill @@ -129,54 +133,80 @@ class Scenario(): 'total_loan': {year: float} 'net_savings': {year: float} } - # """ + """ graph_dict = {} proforma_bill = self.get_post_energy_bill() annual_debt_service = self.get_annual_debt_service() - prior_annual_bill = self.prior_income_statement_table.get_total_energy_dict() + prior_annual_bill = self.prior_income_statement_table.get_total_energy_dict( + ) net_saving_dict = {} print(prior_annual_bill) for year in prior_annual_bill: - net_saving_dict[year] = prior_annual_bill[year] - proforma_bill[year] - annual_debt_service[year] + net_saving_dict[ + year] = prior_annual_bill[year] - proforma_bill[year] - annual_debt_service[year] graph_dict = { 'energy_expenses': proforma_bill, 'total_loan': annual_debt_service, - 'net_savings': net_saving_dict} + 'net_savings': net_saving_dict + } return graph_dict - -# ***** ugly test that can be a guide for front end dev ***** -# growth_toggle = 0.01 -# prior_IS_table = Income_Statement_Table( -# db.raw_income_input, -# db.bill_overview_organized) -# prior_IS_table.project(growth_toggle, db.analysis_date, db.bill_overview_organized) -# prior_BS_table = Balance_Sheet_Table(db.raw_balance_sheet) -# prior_BS_table.project_balance_sheet( -# db.analysis_date, -# db.liability_dictionary, -# prior_IS_table.get_noi_dict()) - -# scenario = Scenario( -# analysis_date=db.analysis_date, -# commission_date=db.commission_date, -# construction_cost=50000, -# bill_overview=db.bill_overview, -# prior_annual_bill_table=db.bill_overview_organized, -# other_debt_service=db.liability_dictionary, -# prior_income_statement_table=prior_IS_table, -# prior_balance_sheet_table=prior_BS_table, -# loan_input_list=db.loan_input_list -# ) - -# scenario.prelim_anlaysis( -# prior_month_bill=db.prior_month_bill, -# percent_saving_dict=db.percent_saving_dict, -# full_saving_dict=db.full_saving_dict, -# growth_rate_flag=growth_toggle, -# req_dscr=db.req_dscr, -# customer_preference=db.customer_preference) + def get_economics(self): + """ + Return: + dictionary: { + 'estimated_cost': float, + 'overall_saving': float, inpercent, + 'first_year_saving': float, indollar, + 'simple_payback': float, in year, + 'min_saving_dscr': float, in x multiple, + 'min_noi_dscr': float, in x multiple, + 'min_cash_dscr': float, in x multiple} + + To Do: generate dscr for every year + """ + economics_overview = {} + economics_overview['estimated_cost'] = self.construction_cost + economics_overview['overall_saving'] = self.saving_overview.get_total_saving_percent() + economics_overview['first_year_saving'] = self.saving_overview.get_total_first_year_saving() + economics_overview['simple_payback'] = self.saving_overview.get_simple_payback(self.construction_cost) + return economics_overview + + +# # ***** ugly test that can be a guide for front end dev ***** +# # liability_dictionary = cash_balance('dict of tuples, date: (float, boolean)') + +growth_toggle = 0.01 +prior_IS_table = Income_Statement_Table( + db.raw_income_input, + db.bill_overview_organized) +prior_IS_table.project(growth_toggle, db.analysis_date, db.bill_overview_organized) +prior_BS_table = Balance_Sheet_Table(db.raw_balance_sheet) +prior_BS_table.project_balance_sheet( + db.analysis_date, + db.liability_dictionary, + prior_IS_table.get_noi_dict()) + +scenario = Scenario( + analysis_date=db.analysis_date, + commission_date=db.commission_date, + construction_cost=50000, + bill_overview=db.bill_overview, + prior_annual_bill_table=db.bill_overview_organized, + other_debt_service=db.liability_dictionary, + prior_income_statement_table=prior_IS_table, + prior_balance_sheet_table=prior_BS_table, + loan_input_list=db.loan_input_list +) + +scenario.prelim_anlaysis( + prior_month_bill=db.prior_month_bill, + percent_saving_dict=db.percent_saving_dict, + full_saving_dict=db.full_saving_dict, + growth_rate_flag=growth_toggle, + req_dscr=db.req_dscr, + customer_preference=db.customer_preference) # print(scenario.get_annual_debt_service()) # print(scenario.get_graph_dict()) -# print(scenario.get_graph_dict()) +print(scenario.get_economics()) -- GitLab From b6a34d99b7bb84d73d5587d7ec6d3d6606dfed78 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Thu, 4 May 2017 18:22:53 -0400 Subject: [PATCH 2/6] Organize formmating --- bpfin/financials/scenario.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/bpfin/financials/scenario.py b/bpfin/financials/scenario.py index 677a5dc..e2c3efc 100644 --- a/bpfin/financials/scenario.py +++ b/bpfin/financials/scenario.py @@ -23,10 +23,8 @@ class Scenario(): self.prior_annual_bill_table = copy.deepcopy(prior_annual_bill_table) self.other_debt_service = copy.deepcopy(other_debt_service) - self.prior_income_statement_table = copy.deepcopy( - prior_income_statement_table) - self.prior_balance_sheet_table = copy.deepcopy( - prior_balance_sheet_table) + self.prior_income_statement_table = copy.deepcopy(prior_income_statement_table) + self.prior_balance_sheet_table = copy.deepcopy(prior_balance_sheet_table) self.post_income_statement_table = None self.post_balance_sheet_table = None @@ -53,12 +51,9 @@ class Scenario(): full_saving_dict=full_saving_dict) # generate post_saving income_statement_table object - post_annual_bill_table = copy.deepcopy( - self.saving_overview.get_post_annual_bill_table()) - post_income_statement_table = copy.deepcopy( - self.prior_income_statement_table) - post_income_statement_table.project( - growth_rate_flag, self.analysis_date, post_annual_bill_table) + post_annual_bill_table = copy.deepcopy(self.saving_overview.get_post_annual_bill_table()) + post_income_statement_table = copy.deepcopy(self.prior_income_statement_table) + post_income_statement_table.project(growth_rate_flag, self.analysis_date, post_annual_bill_table) self.post_income_statement_table = post_income_statement_table # generate post_saving balance_sheet_table object @@ -95,8 +90,7 @@ class Scenario(): def get_post_energy_bill(self): proforma_year = form_bill_year(self.analysis_date['proforma_start'], self.analysis_date['proforma_duration']) - post_annual_bill_table = copy.deepcopy( - self.saving_overview.get_post_annual_bill_table()) + post_annual_bill_table = copy.deepcopy(self.saving_overview.get_post_annual_bill_table()) utility_type_list = ['electricity', 'gas', 'oil', 'water'] post_energy_bill = {} -- GitLab From 3a38120559323c28915e4e5f639d64b04ae5b4f1 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Thu, 4 May 2017 18:50:37 -0400 Subject: [PATCH 3/6] merge test --- bpfin/financials/scenario.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bpfin/financials/scenario.py b/bpfin/financials/scenario.py index e2c3efc..23124a5 100644 --- a/bpfin/financials/scenario.py +++ b/bpfin/financials/scenario.py @@ -169,7 +169,6 @@ class Scenario(): # # ***** ugly test that can be a guide for front end dev ***** # # liability_dictionary = cash_balance('dict of tuples, date: (float, boolean)') - growth_toggle = 0.01 prior_IS_table = Income_Statement_Table( db.raw_income_input, -- GitLab From 23333aa3864f993f8f96ba65e3310418558a58a6 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Thu, 4 May 2017 20:33:32 -0400 Subject: [PATCH 4/6] Finalize get_economics in scenario class --- bpfin/financials/financial_lib.py | 10 +++ bpfin/financials/scenario.py | 125 ++++++++++++++--------------- bpfin/lib/other.py | 18 +++++ bpfin/tests/test_lib/test_other.py | 12 ++- 4 files changed, 98 insertions(+), 67 deletions(-) diff --git a/bpfin/financials/financial_lib.py b/bpfin/financials/financial_lib.py index d452d45..dabbf2b 100644 --- a/bpfin/financials/financial_lib.py +++ b/bpfin/financials/financial_lib.py @@ -644,6 +644,16 @@ class Balance_Sheet_Table(): if current_balance_sheet.year == first_year: return current_balance_sheet.cash + def get_cash_dict(self): + """ + Get a dictionary of cash. + Return: + dictionary: cash for each year in balance sheet table. Key is year + """ + cash_dict = {} + for current_balance_sheet in self.bs_table: + cash_dict[current_balance_sheet.year] = current_balance_sheet.cash + return cash_dict # # ************ guide for front end dev *********** # # First, fill in bill overview, save it. diff --git a/bpfin/financials/scenario.py b/bpfin/financials/scenario.py index c015be2..007a362 100644 --- a/bpfin/financials/scenario.py +++ b/bpfin/financials/scenario.py @@ -2,10 +2,11 @@ import copy from bpfin.financials.saving import Saving_Overview from bpfin.financials.loan import Loan_List from bpfin.tests.testdata import sample_data as db +from bpfin.lib.other import add_year_dictionary, divide_dscr_dict, min_none_list from bpfin.financials.financial_lib import Income_Statement_Table, Balance_Sheet_Table from bpfin.utilbills.bill_lib import form_bill_year, annualizing_projection # may delete from here after sample built -from bpfin.financials.cash_balance import cash_balance +# from bpfin.financials.cash_balance import cash_balance class Scenario(): @@ -134,10 +135,9 @@ class Scenario(): prior_annual_bill = self.prior_income_statement_table.get_total_energy_dict( ) net_saving_dict = {} - print(prior_annual_bill) + # print(prior_annual_bill) for year in prior_annual_bill: - net_saving_dict[ - year] = prior_annual_bill[year] - proforma_bill[year] - annual_debt_service[year] + net_saving_dict[year] = prior_annual_bill[year] - proforma_bill[year] - annual_debt_service[year] graph_dict = { 'energy_expenses': proforma_bill, 'total_loan': annual_debt_service, @@ -145,6 +145,25 @@ class Scenario(): } return graph_dict + def get_dscr(self): + + pro_forma_years = form_bill_year(self.analysis_date['proforma_start'], + self.analysis_date['proforma_duration']) + noi_dict = copy.deepcopy(self.post_income_statement_table.get_noi_dict()) + cash_dict = copy.deepcopy(self.post_balance_sheet_table.get_cash_dict()) + debt_dict = self.get_annual_debt_service() + savings_dict = {} + utility_type_list = ['electricity', 'gas', 'oil', 'water'] + for utility_type in utility_type_list: + savings_dict = add_year_dictionary( + savings_dict, self.saving_overview.get_utility_annual_saving_charge(utility_type)) + + dscr_dict = {} + dscr_dict['noi_dscr'] = divide_dscr_dict(noi_dict, debt_dict) + dscr_dict['cash_dscr'] = divide_dscr_dict(cash_dict, debt_dict) + dscr_dict['saving_dscr'] = divide_dscr_dict(savings_dict, debt_dict) + return dscr_dict + def get_economics(self): """ Return: @@ -159,78 +178,52 @@ class Scenario(): To Do: generate dscr for every year """ + dscr_dict = self.get_dscr() economics_overview = {} economics_overview['estimated_cost'] = self.construction_cost economics_overview['overall_saving'] = self.saving_overview.get_total_saving_percent() economics_overview['first_year_saving'] = self.saving_overview.get_total_first_year_saving() economics_overview['simple_payback'] = self.saving_overview.get_simple_payback(self.construction_cost) + economics_overview['min_saving_dscr'] = min_none_list(dscr_dict['saving_dscr'].values()) + economics_overview['min_noi_dscr'] = min_none_list(dscr_dict['noi_dscr'].values()) + economics_overview['min_cash_dscr'] = min_none_list(dscr_dict['cash_dscr'].values()) return economics_overview - def get_dscr(self, analysis_date, noi_dict, cash_dict, savings_dict, - debt_dict): - - pro_forma_years = form_bill_year(analysis_date['proforma_start'], - analysis_date['proforma_duration']) - - dscr_dict = {'noi_dict': {}, 'cash_dict': {}, 'savings_dict': {}} - - for year in pro_forma_years: - noi_temp_dict = {} - cash_temp_dict = {} - savings_temp_dict = {} - if year in debt_dict and debt_dict[year] != 0: - if year in noi_dict: - noi_temp_dict[year] = noi_dict[year] / debt_dict[ - year] - noi_temp_dict[year] = -1 - if year in cash_dict: - cash_temp_dict[year] = cash_dict[year] / debt_dict[ - year] - noi_temp_dict[year] = -1 - if year in savings_dict: - savings_temp_dict[year] = savings_dict[ - year] / debt_dict[year] - noi_temp_dict[year] = -1 - dscr_dict['noi_dict'] = noi_temp_dict - dscr_dict['cash_dict'] = cash_temp_dict - dscr_dict['savings_dict'] = savings_temp_dict - - return dscr_dict - # # ***** ugly test that can be a guide for front end dev ***** # # liability_dictionary = cash_balance('dict of tuples, date: (float, boolean)') -growth_toggle = 0.01 -prior_IS_table = Income_Statement_Table( - db.raw_income_input, - db.bill_overview_organized) -prior_IS_table.project(growth_toggle, db.analysis_date, db.bill_overview_organized) -prior_BS_table = Balance_Sheet_Table(db.raw_balance_sheet) -prior_BS_table.project_balance_sheet( - db.analysis_date, - db.liability_dictionary, - prior_IS_table.get_noi_dict()) - -scenario = Scenario( - analysis_date=db.analysis_date, - commission_date=db.commission_date, - construction_cost=50000, - bill_overview=db.bill_overview, - prior_annual_bill_table=db.bill_overview_organized, - other_debt_service=db.liability_dictionary, - prior_income_statement_table=prior_IS_table, - prior_balance_sheet_table=prior_BS_table, - loan_input_list=db.loan_input_list -) - -scenario.prelim_anlaysis( - prior_month_bill=db.prior_month_bill, - percent_saving_dict=db.percent_saving_dict, - full_saving_dict=db.full_saving_dict, - growth_rate_flag=growth_toggle, - req_dscr=db.req_dscr, - customer_preference=db.customer_preference) +# growth_toggle = 0.01 +# prior_IS_table = Income_Statement_Table( +# db.raw_income_input, +# db.bill_overview_organized) +# prior_IS_table.project(growth_toggle, db.analysis_date, db.bill_overview_organized) +# prior_BS_table = Balance_Sheet_Table(db.raw_balance_sheet) +# prior_BS_table.project_balance_sheet( +# db.analysis_date, +# db.liability_dictionary, +# prior_IS_table.get_noi_dict()) + +# scenario = Scenario( +# analysis_date=db.analysis_date, +# commission_date=db.commission_date, +# construction_cost=60000, +# bill_overview=db.bill_overview, +# prior_annual_bill_table=db.bill_overview_organized, +# other_debt_service=db.liability_dictionary, +# prior_income_statement_table=prior_IS_table, +# prior_balance_sheet_table=prior_BS_table, +# loan_input_list=db.loan_input_list +# ) + +# scenario.prelim_anlaysis( +# prior_month_bill=db.prior_month_bill, +# percent_saving_dict=db.percent_saving_dict, +# full_saving_dict=db.full_saving_dict, +# growth_rate_flag=growth_toggle, +# req_dscr=db.req_dscr, +# customer_preference=db.customer_preference) # print(scenario.get_annual_debt_service()) # print(scenario.get_graph_dict()) -print(scenario.get_economics()) +# print(scenario.get_dscr()) +# print(scenario.get_economics()) diff --git a/bpfin/lib/other.py b/bpfin/lib/other.py index 6c08367..7f4e6b8 100644 --- a/bpfin/lib/other.py +++ b/bpfin/lib/other.py @@ -3,6 +3,7 @@ import calendar import numpy as np from scipy.optimize import linprog + def add_year_dictionary(dict_1, dict_2): summed_dict = {x: dict_1.get(x, 0) + dict_2.get(x, 0) for x in set(dict_1).union(dict_2)} return summed_dict @@ -13,6 +14,23 @@ def subtract_year_dictionary(dict_1, dict_2): return summed_dict +def divide_dscr_dict(dict_1, dict_2): + ratio_dict = { + x: (dict_1.get(x, 0) / dict_2.get(x, 0) + if dict_2.get(x, 0) != 0 else None) + for x in set(dict_1).union(dict_2) + } + return ratio_dict + + +def min_none_list(list_1): + new_list = [] + for element in list_1: + if element is not None: + new_list.append(element) + return min(new_list) + + def add_list(obj_list, number): """Add a number to each value in a list. diff --git a/bpfin/tests/test_lib/test_other.py b/bpfin/tests/test_lib/test_other.py index 78a6f3d..0fdbb95 100644 --- a/bpfin/tests/test_lib/test_other.py +++ b/bpfin/tests/test_lib/test_other.py @@ -1,4 +1,6 @@ -from bpfin.lib.other import add_year_dictionary, subtract_year_dictionary +from bpfin.lib.other import add_year_dictionary +from bpfin.lib.other import subtract_year_dictionary +from bpfin.lib.other import divide_dscr_dict from bpfin.tests.testdata import sample_data as db @@ -17,3 +19,11 @@ def test_subtract_year_dictionary(): output = db.dict_sub result = subtract_year_dictionary(year_1_input, year_2_input) assert result == output + + +def test_divide_dscr_dict(): + year_1_input = db.dict_year_1 + year_2_input = db.dict_year_2 + output = {2011: 0.0, 2012: 2.5, 2013: 0.3333333333333333, 2014: 2.0, 2015: None} + result = divide_dscr_dict(year_1_input, year_2_input) + assert result == output -- GitLab From 65f1aa1f32f2334ed7c550ac66750a415fb600bb Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Thu, 4 May 2017 20:36:20 -0400 Subject: [PATCH 5/6] Clean import in scenario --- bpfin/financials/scenario.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bpfin/financials/scenario.py b/bpfin/financials/scenario.py index 007a362..fc069c7 100644 --- a/bpfin/financials/scenario.py +++ b/bpfin/financials/scenario.py @@ -1,12 +1,12 @@ import copy from bpfin.financials.saving import Saving_Overview from bpfin.financials.loan import Loan_List -from bpfin.tests.testdata import sample_data as db from bpfin.lib.other import add_year_dictionary, divide_dscr_dict, min_none_list -from bpfin.financials.financial_lib import Income_Statement_Table, Balance_Sheet_Table from bpfin.utilbills.bill_lib import form_bill_year, annualizing_projection # may delete from here after sample built -# from bpfin.financials.cash_balance import cash_balance +from bpfin.financials.cash_balance import cash_balance +from bpfin.financials.financial_lib import Income_Statement_Table, Balance_Sheet_Table +from bpfin.tests.testdata import sample_data as db class Scenario(): @@ -76,8 +76,7 @@ class Scenario(): self.post_balance_sheet_table.get_first_year_cash( self.commission_date)) - # print('first year =', first_year_saving, first_year_noi, first_year_cash) - # print(self.loan_list.loan_list[0].institute) + # allocate loan and calculate loan schedule for each loan scheduled_loan_list = self.loan_list.get_schedule( customer_preference=customer_preference, cost=self.construction_cost, @@ -135,7 +134,6 @@ class Scenario(): prior_annual_bill = self.prior_income_statement_table.get_total_energy_dict( ) net_saving_dict = {} - # print(prior_annual_bill) for year in prior_annual_bill: net_saving_dict[year] = prior_annual_bill[year] - proforma_bill[year] - annual_debt_service[year] graph_dict = { @@ -146,12 +144,10 @@ class Scenario(): return graph_dict def get_dscr(self): - - pro_forma_years = form_bill_year(self.analysis_date['proforma_start'], - self.analysis_date['proforma_duration']) noi_dict = copy.deepcopy(self.post_income_statement_table.get_noi_dict()) cash_dict = copy.deepcopy(self.post_balance_sheet_table.get_cash_dict()) debt_dict = self.get_annual_debt_service() + savings_dict = {} utility_type_list = ['electricity', 'gas', 'oil', 'water'] for utility_type in utility_type_list: -- GitLab From 142fcb8aaf5852e216b277af6ffc990dfcf619d7 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Thu, 4 May 2017 20:40:31 -0400 Subject: [PATCH 6/6] finalize --- bpfin/financials/scenario.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bpfin/financials/scenario.py b/bpfin/financials/scenario.py index fc069c7..5f3f992 100644 --- a/bpfin/financials/scenario.py +++ b/bpfin/financials/scenario.py @@ -187,6 +187,7 @@ class Scenario(): # # ***** ugly test that can be a guide for front end dev ***** + # # liability_dictionary = cash_balance('dict of tuples, date: (float, boolean)') # growth_toggle = 0.01 # prior_IS_table = Income_Statement_Table( -- GitLab