Real Estate vs. Equity Simulation Engine
Project description
Rent vs. Buy Simulator
A financial simulation tool that compares three capital allocation strategies over time:
- Buy — Purchase property with a mortgage
- Rent & Invest — Rent and invest the down payment in equities
- Rent & Invest Savings — Rent and invest monthly savings (when mortgage > rent)
Features
- Mortgage amortization, property appreciation, equity growth, closing costs, property tax, insurance, and maintenance
- Tax benefit modeling: mortgage interest deduction, capital gains exclusion (Section 121), SALT cap
- Four interactive Plotly charts with breakeven analysis
- Quick presets for common scenarios (High Interest, Bull Market, Conservative, First-Time Buyer)
- Save, compare, and export up to 5 scenarios side-by-side
- PDF report export with charts and configuration summary
- Monte Carlo uncertainty analysis with stochastic simulation
- Vectorized NumPy engine — no Python loops
Installation
From PyPI
# As a CLI tool (recommended)
uv tool install rent-vs-buy-simulator
rent-vs-buy
# Or as a library
uv pip install rent-vs-buy-simulator
From Source
git clone https://github.com/palsagar/rent-vs-buy-simulator.git
cd rent-vs-buy-simulator
uv sync
streamlit run src/simulator/app.py
Docker
# Local development
docker compose up --build
# Open http://localhost:8501
# Production
docker build -t rent-vs-buy-simulator .
docker run -p 8501:8501 rent-vs-buy-simulator
Library Usage
from simulator import SimulationConfig, calculate_scenarios
config = SimulationConfig(
duration_years=30,
property_price=500000,
down_payment_pct=20,
mortgage_rate_annual=4.5,
property_appreciation_annual=3.0,
equity_growth_annual=7.0,
monthly_rent=2000,
rent_inflation_rate=0.03,
)
results = calculate_scenarios(config)
print(f"Buy: ${results.final_net_buy:,.0f}")
print(f"Rent & Invest: ${results.final_net_rent:,.0f}")
print(f"Difference: ${results.final_difference:,.0f}")
Contributing
Contributions welcome! Fork the repo, create a feature branch, and open a PR against main.
uv sync
uv run pytest tests/ --cov --cov-report=term # 80% coverage minimum
uv run ruff check src/ tests/
See FORMULAS.md for the mathematical reference.
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rent_vs_buy_simulator-1.0.0.tar.gz.
File metadata
- Download URL: rent_vs_buy_simulator-1.0.0.tar.gz
- Upload date:
- Size: 171.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
426b0eaf7191aecb3374baaefc91053320fbab248be74c9091df563eec19f253
|
|
| MD5 |
4a64a9478d2b8fa88398f28e330b457c
|
|
| BLAKE2b-256 |
0f3d86e169f92204c97cc076839df2ef66ced10f88499ab21ab38a97867a12f4
|
File details
Details for the file rent_vs_buy_simulator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rent_vs_buy_simulator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daf9b7ed8f0a1a53e17345d78ec2ea5503de56dd6719c772aaecfa040230e3fa
|
|
| MD5 |
cfaa1837af0d0efb55f431dbed19d355
|
|
| BLAKE2b-256 |
69cf82e8cb4d27b86d50cd72b17e89818e6bcf2f1409020ed8fc365c828de1a4
|