-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathROI_clac.py
190 lines (152 loc) · 7.17 KB
/
ROI_clac.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
class Income():
def __init__(self, rentalI, extraI= 0): #takes in all the variables you will need to calcuate income
self.rentalI = int(rentalI)
self.extraI = int(extraI)
def calcIncome(self): #claculates the total income of the property
self.income = self.rentalI + self.extraI
return self.income
class Expenses():
def __init__(self, tax,insurance,utilities,HOA,lsCare,vacancy,repairs,capex,management,mortgage): #takes in all the varaibles need to to calculate expenses
self.tax = int(tax)
self.insurance = int(insurance)
self.utilities = int(utilities)
self.HOA = int(HOA)
self.lsCare = int(lsCare)
self.vacancy = int(vacancy)
self.repairs = int(repairs)
self.capex = int(capex)
self.management = int(management)
self.mortgage = int(mortgage)
def calcExpenses(self): #calculates total expenses
self.expenses = self.tax + self.insurance + self.utilities + self.HOA + self.lsCare + self.vacancy + self.repairs + self.capex + self.management + self.mortgage
return self.expenses
class ROI():
def __init__(self,downPay,closingCost,repairBudget,misc =0): #takes in all the varaibles you will need to calculate the retrun on investment
self.downpay = int(downPay)
self.closingCost = int(closingCost)
self.repairBudget = int(repairBudget)
self.misc = int(misc)
def calcCashFlow(self): #calculates cash flow
self.cashFlow = self.income - self.expenses
return self.cashFlow
def totalInvestment(self): #calculates the total amount of money you put into the property
self.totalI = self.downpay + self.closingCost + self.repairBudget + self.misc
return self.totalI
def annualCashFlow(self): #calcluates the profit you will make in a year
self.annualCash = self.cashFlow *12
return self.annualCash
def totalROI(self): #calculates your return on investment
self.totalROI = self.annualCash / self.totalI
return '{0:.2%}'.format(self.totalROI)
class Proptery(Income,Expenses,ROI):
def __init__(self,address,cost,type,rentalI,extraI,tax,insurance,utilities,HOA,lsCare,vacancy,repairs,capex,management,mortgage,downPay,closingCost,repairBudget,misc): # takes in all the information about the rental property
Income.__init__(self, rentalI, extraI)
Expenses.__init__(self, tax,insurance,utilities,HOA,lsCare,vacancy,repairs,capex,management,mortgage)
ROI.__init__(self,downPay,closingCost,repairBudget,misc)
self.address = address
self.cost = int(cost)
self.type = type
def propInfo(self):
print("=======================================================")
print(f"The {self.type} you are looking to buy at {self.address} costs ${self.cost}")
print(f"Your total rental income is ${self.calcIncome()}")
print(f"Your total expenses are ${self.calcExpenses()}")
print(f"Your total cash flow is ${self.calcCashFlow()}")
print(f"Your total investment is ${self.totalInvestment()}")
print(f"Your total anual cashflow is ${self.annualCashFlow()}")
print(f"Your total anual ROI is {self.totalROI()}")
class Main():
def check(var): #checks if the in put is an integer
try:
if isinstance(int(var),int):
return False
except ValueError:
print("Invalid input please try input a integer!")
return True
def run():
address = input("What is the address of the property you are trying to buy? ").title().strip()
rentalType = input("What kind of property is it? (ex: apartment, duplex, house) ").strip()
a = True
while a == True:
cost = input("How much is the property you are trying to buy? ").strip()
a = Main.check(cost)
a = True
while a == True:
rentalI = input("How much rental income will you generate? ").strip()
a = Main.check(rentalI)
a = True
while a == True:
extraI = input("Do you have any extra income you would like to account for? ").strip()
a = Main.check(extraI)
a = True
while a == True:
tax = input("How much will you be paying in propety taxes? ").strip()
a = Main.check(tax)
a = True
while a == True:
insurance = input("How much will you be paying in insurance? ").strip()
a = Main.check(insurance)
a = True
while a == True:
utilities = input("How much will you be paying for utilities? ").strip()
a = Main.check(utilities)
a = True
while a == True:
HOA = input("How much will you have to pay to the Home Oweners Association? ").strip()
a = Main.check(HOA)
a = True
while a == True:
lsCare = input("How much will you pay for in lawn care or other services? ").strip()
a = Main.check(lsCare)
a = True
while a == True:
vacancy = input("How much will you set aside for vacancy? ").strip()
a = Main.check(vacancy)
a = True
while a == True:
repairs = input("How much will you set aside for repairs? ").strip()
a = Main.check(repairs)
a = True
while a == True:
capex = input("How much will you set aside for capital expenses? ").strip()
a = Main.check(capex)
a = True
while a == True:
management = input("How much are you going to pay for property management? ").strip()
a = Main.check(management)
a = True
# b = False
while True:
payInFull = input("Will you be paying in full 'yes' or 'no'? ").lower().strip()
if payInFull == 'no':
while a == True:
mortgage = input("How much will your mortgage payment be? ").strip()
a = Main.check(mortgage)
a = True
while a == True:
downPay = input("How much will your down payment be? ").strip()
a = Main.check(downPay)
a = True
# b = False
break
elif payInFull == 'yes':
mortgage = 0
downPay = cost
break
else:
print("Invalid input please enter 'yes' or 'no'" )
while a == True:
closingCost = input("How much will the closing cost be? ").strip()
a = Main.check(closingCost)
a = True
while a == True:
repairBudget = input("How much is your repiar budget? ").strip()
a = Main.check(repairBudget)
a = True
while a == True:
misc = input("Do you have miscellaneous costs you would like to account for?").strip()
a = Main.check(misc)
a = True
rental = Proptery(address,cost,rentalType,rentalI,extraI,tax,insurance,utilities,HOA,lsCare,vacancy,repairs,capex,management,mortgage,downPay,closingCost,repairBudget,misc)
rental.propInfo()
Main.run()