Sold home prices and comps in Python
HomeHarvest returns recently sold US homes with the sold price, sold date, list price, beds, baths, square feet and the listing agent. Search a city or ZIP code, or pull comps within a radius of one address. It's free and needs no API key.
How do I get homes that sold in the last 30 days?
Set listing_type="sold" and past_days. For sold homes, past_days counts back from the sold date.
from homeharvest import scrape_property
homes = scrape_property(location="San Diego, CA", listing_type="sold", past_days=30, limit=100)
print(len(homes), "homes sold in the last 30 days")
print(homes[["formatted_address", "sold_price", "last_sold_date", "beds", "sqft"]].head())Tested with homeharvest 0.8.18 and 0.9.0 on 2026-11-23.
How do I pull comps near an address?
Pass a full street address and a radius in miles. This gets every sale within 1 mile in the last 180 days, then works out the median price and price per square foot.
from homeharvest import scrape_property
# Homes that sold within 1 mile of an address in the last 180 days.
# radius only works when location is a full street address.
comps = scrape_property(
location="1 Dr Carlton B Goodlett Pl, San Francisco, CA 94102",
listing_type="sold",
radius=1.0,
past_days=180,
limit=200,
)
if comps.empty:
print("No sales found. Try a larger radius or more days.")
else:
comps = comps[comps["sqft"] > 0]
comps["price_per_sqft"] = comps["sold_price"] / comps["sqft"]
print(len(comps), "comps")
print("Median sold price:", int(comps["sold_price"].median()))
print("Median $/sqft:", int(comps["price_per_sqft"].median()))
print(comps[["formatted_address", "sold_price", "last_sold_date", "beds", "sqft"]]
.sort_values("last_sold_date", ascending=False).head(10).to_string(index=False))Tested with homeharvest 0.8.18 and 0.9.0 on 2026-11-23.
Narrow the comps with filters like beds_min, beds_max, sqft_min, sqft_max, year_built_min and property_type=["single_family"].
How do I get the median sold price by ZIP code?
Pull a whole city, then group by zip_code with pandas.
from homeharvest import scrape_property
sold = scrape_property(
location="Phoenix, AZ",
listing_type="sold",
past_days=30,
property_type=["single_family"],
limit=1000,
extra_property_data=False, # skip per-home details for a faster pull
)
if sold.empty:
print("No sales found.")
else:
by_zip = (
sold.groupby("zip_code")["sold_price"]
.agg(["count", "median"])
.sort_values("count", ascending=False)
)
print(by_zip.head(10).to_string())
sold.to_csv("phoenix_sold_30d.csv", index=False)Tested with homeharvest 0.8.18 and 0.9.0 on 2026-11-23.
Output (example values):
count median
zip_code
85254 78 967500.0
85339 49 455000.0
85018 41 1770000.0
Which columns come back for sold homes?
| Column | What it is |
|---|---|
sold_price | Price the home sold for |
last_sold_date | Date it sold |
list_price, list_date | Last asking price and when it was listed |
days_on_mls | Days on market |
price_per_sqft | Price per square foot |
estimated_value | Current value estimate |
beds, full_baths, half_baths, sqft, lot_sqft, year_built, style | Home details |
agent_name, agent_email, agent_phones, office_name | The listing agent and office |
buyer_agent_name, buyer_agent_email, buyer_office_name | The buyer's agent (0.9.0, when listed) |
original_list_price, property_history | Where the price started, and every price change (0.9.0) |
mls, mls_id | Source MLS and its listing number |
latitude, longitude, county, fips_code | Location |
How far back can I go?
Use date_from and date_to (for example "2025-01-01" and "2025-06-30") for a fixed window. Each search returns at most 10,000 homes, so split big pulls into monthly windows or by ZIP code. Set mls_only=True to keep only sales with an MLS listing.
Are these real sold prices or estimates?
sold_price is the sale price recorded on the listing. Value estimates live in a separate column, estimated_value.
Sale prices are blank in non-disclosure states. States such as Texas and Utah don't make sale prices public. In our test on 2026-11-23, 200 recent sales each in Houston and Salt Lake City had no sold_price, while 200 in San Diego all had one. You still get the sold date, list price, home details and agent there. Check sold["sold_price"].notna().mean() before you average.
How fresh is the data?
New sales usually show up within days of closing, as the listing is updated. In our tests, a 30-day pull for San Diego included sales from 3 days earlier.
Last updated 2026-11-23. Report a problem.