Skip to content

Automatically analyze real estate properties either specified or matching your search criteria and email the best deals!

License

Notifications You must be signed in to change notification settings

ShanaryS/real-estate-calculator-bot

Repository files navigation

Real Estate Calculator Bot

Features

  • Parses the HTML doc of a zillow property page or search page using BeautifulSoup, Selenium, and RegEx. Defeating captchas along the way.
  • Automatically send an email via SMPT with SSL whenever a great investment opportunity arises, according to your heuristics.
  • Email credentials can be saved in a .env file for a temporary creation of an environmental variable.
  • Analyze a property given a https://www.zillow.com/homedetails/* URL with SQLite. Print analysis with Pandas or store locally in JSON.
  • Get property URLs from a zillow search page to automatically analyze all properties of a criteria (Solves captcha if it appears).
  • Easy adding, deleting, ignoring, and overwriting saved URLs with a decision tree.
  • Uses real time mortgage interest rates.
  • Errors are gracefully handled and saved in a log file which includes exception type, traceback, and offers potential solutions to the issue. Failures do not interrupt the program, that specific property is simply skipped in the analysis.
  • Inputs are checked to prevent errors as well as URLs are verified to be valid.
  • Uses hash maps and set operations for quick calculations and manipulations of data.
  • Prefers false positives over false negatives

Examples

Instantly analyze a single property with all the fundamental real estate metrics!

animated


Automatically get property URLs from a search criteria! (P.S. Also beats captchas!)

animated


Analyze thousands of properties faster than you ever could!

animated


Adding new properties to track is easy with the decision tree!

animated


Automatically get emailed whenever the best deals are found!

About

This is a bot for analyzing residential (1-4 units) real estate properties. Able to either analyze a single property and print its analysis or input a search criteria that analyze all the properties that fit. Emails best deals from all the properties analyzed. Analysis includes:

Return On Investment, Cash on Cash Return, Caprate, Cashflow, Max Offer, Emergency Fund, Amortizaton Table*
* When printing analysis of a single property only.

Data is stored locally in JSON files in /output/ as well as the logs for errors. The URLs inputted (from run_property_tracker) are saved in urls.json while the final analysis of all those URLs are stored in analysis.json. The README.md in /output/ contains more information on how data and errors are stored.

Requires either a https://www.zillow.com/homedetails/* URL for individual properties or a search URL. Adding, deleting, and ignoring properties are done through a decision tree in the terminal. It contains the necessary information on how to use each option.

Interest rates are retrieved once at start up from https://www.nerdwallet.com/mortgages/mortgage-rates and used for all subsequent analysis in the session. Property taxes are retrieved from the Zillow property page if it exists, else it defaults to https://www.countyoffice.org/tax-records/ which usually has the info. (Note: There is a limit on the number times you can get the property taxes info from the county office, at 5 properties, you will be restricted for the day. Luckily Zillow usually has the property taxes and thus rarely falls back to county office. Though if you wanted to get around that limitation, you would need to use a VPN.)

The resulting analyses is currently over fitted to multi-family properties in CT. To fix, edit the CONSTANTS found in values.py to fit your heuristics. CONSTANTS are defined by all caps. In there you can also adjust the criteria for a 'good deal' which decides what properties to email.

Notes

  • To get the property URLs from a search URL, selenium is required (For direct property analysis, either through print or run_analysis, it is not required). The properties are dynamically loaded behind a JavaScript script. The only way of accessing those properties is to scroll to the bottom of the page, then parse the html doc. I am using the chromedriver for selenium. Tutorial for setting up here.
  • Emails are sent over the gmail SMTP server. It is not necessary to the program, but a nice bonus. For using the email feature, I recommend using a separate gmail account to send/receive the mail. Enable 2FA and use an app password for the script. I suggest creating a local ".env" file in the parent directory containing two lines of your email and app password. More details are in push_best_deals_to_email.py.
  • To automate this program, I recommend using Windows task scheduler or the Mac/Linux equivalent. There was no need to have this program running 24/7.

Installation (Python 3.9.9)

Clone this repo and cd into it:

git clone https://github.com/ShanaryS/real-estate-calculator-bot.git
cd real-estate-calculator-bot

Create and activate your virtual environment:

  • Windows:
python -m venv venv
venv\Scripts\activate
  • MacOS/Linux:
virtualenv --no-site-packages venv
source venv/bin/activate

Install the required packages:

pip install -r requirements.txt

Usage

All the files that you should interact with to use the program is in the main directory. Either prefixed with run_* or values.py for editing constants.

To create portable .exe files, setup the virtual environment as described above along with installing requirements.txt (On windows just run 'create_venv.bat'). Then simply run the 'create_exe.bat' file. After about 2 minutes, all executables will be in the newly created 'bin' folder in the root of the project.

  • Add a property or search criteria to track:
python run_property_tracker
  • Analyze all tracked properties:
python run_analysis
  • Refresh search properties without input (Useful for automatically refreshing while unattended):
python run_refresh_listings_from_search
  • Print analysis of single property without saving, including amortization table (Useful for analyzing just a single property):
python run_single_property_analysis_print_only

License

MIT

About

Automatically analyze real estate properties either specified or matching your search criteria and email the best deals!

Resources

License

Stars

Watchers

Forks