YongHuang commited on
Commit
2fe6a3b
·
1 Parent(s): 64dd394
Files changed (1) hide show
  1. rebot.py +0 -118
rebot.py DELETED
@@ -1,118 +0,0 @@
1
- import requests
2
- from requests import get
3
- from bs4 import BeautifulSoup
4
- import pandas
5
- import itertools
6
- import streamlit as st
7
-
8
- def net_operating(rent, tax_rate, price):
9
-
10
- #Takes input as monthly mortgage amount and monthly rental amount
11
- #Uses managment expense, amount for repairs, vacancy ratio
12
- #Example input: net_operating(1000,1,400,200)
13
- #879.33
14
- #1000 - 16.67 (tax) - 100 (managment) - 4 (repairs)
15
-
16
- mortgage_amt = mortgage_monthly(price,20,3)
17
- prop_managment = rent * 0.10
18
- prop_tax = (price * (tax_rate/100)/12)
19
- prop_repairs = (price * 0.02)/12
20
- vacancy = (rent*0.02)
21
- #These sections are a list of all the expenses used and formulas for each
22
-
23
- net_income = rent - prop_managment - prop_tax - prop_repairs - vacancy - mortgage_amt
24
- #Summing up expenses
25
- output = [prop_managment, prop_tax, prop_repairs, vacancy, net_income]
26
-
27
-
28
- return output
29
-
30
- def down_payment(price,percent):
31
- #This function takes the price and the downpayment rate and returns the downpayment amount
32
- #Ie down_payment(100,20) returns 20
33
- amt_down = price*(percent/100)
34
- return(amt_down)
35
-
36
- def mortgage_monthly(price,years,percent):
37
-
38
-
39
- #This implements an approach to finding a monthly mortgage amount from the purchase price,
40
- #years and percent.
41
- #Sample input: (300000,20,4) = 2422
42
- #
43
-
44
-
45
- percent = percent /100
46
- down = down_payment(price,20)
47
- loan = price - down
48
- months = years*12
49
- interest_monthly = percent/12
50
- interest_plus = interest_monthly + 1
51
- exponent = (interest_plus)**(-1*months)
52
- subtract = 1 - exponent
53
- division = interest_monthly / subtract
54
- payment = division * loan
55
-
56
-
57
- return(payment)
58
-
59
- #to do
60
- def price_mine(pid):
61
- #Currently this function takes an input of a URL and returns the listing prices
62
- #The site it mines is remax
63
- #The input must be a string input, we can reformat the input to force this to work
64
- #Next we use regex to remove space and commas and dollar signs
65
- #need to get from a product id to a price
66
- prices = 0
67
- prices = float(prices)
68
-
69
- return prices
70
-
71
-
72
- def cap_rate(monthly_income, price):
73
- #This function takes net income, and price and calculates the cap rate
74
- #
75
- cap_rate = ((monthly_income*12) / price)*100
76
-
77
- return cap_rate
78
-
79
-
80
- def cash_on_cash(monthly_income, down_payment):
81
- cash_return = ((monthly_income*12)/down_payment)*100
82
- return cash_return
83
-
84
-
85
-
86
- # trial = input("Enter a URL to a Remax listing: ")
87
- # rent_amt = input("Enter the monthly rent price: ")
88
- # property_tax = input("Enter the tax rate: ")
89
- #We have to change these generic inputs to streamlit inputs
90
-
91
- rent_amt = st.sidebar.text_input("Enter the monthly rent price: ")
92
- property_tax = st.sidebar.text_input("Enter the tax rate: ")
93
-
94
- rent_amt = float(rent_amt)
95
- property_tax = float(property_tax)
96
-
97
-
98
- listing_notice = price_mine(1)
99
- mortgage = mortgage_monthly(listing_notice, 20, 3)
100
-
101
- cash = down_payment(listing_notice, 20)
102
- net_income = net_operating(rent_amt, property_tax , listing_notice)
103
- monthly_cash = net_income[4]
104
- cap_return = cap_rate(monthly_cash,listing_notice)
105
- cash_percent = cash_on_cash(monthly_cash,cash)
106
- # net_operating(rent, tax_rate, mortgage_amt, price):
107
-
108
- # print("INPUT: ")
109
- # print("The price of: ", listing_notice)
110
- # print("The monthly rent of : ", rent_amt)
111
- # print("The tax rate of : ", property_tax)
112
- # print("OUTPUTS: ")
113
- # print("Monthly mortgage of : ",mortgage)
114
- # print("Net operating income: ", net_income)
115
- # print("Cap rate of: ", cap_return," % ")
116
- # print("Cash return rate of: ", cash_percent, " % ")
117
-
118
- #We have to convert the above outputs to streamlit outputs