Clock Icon - Technology Webflow Template
10
min read

Understanding Public Housing Sentiment via the Parcl Labs API

Learn how to query public sentiment around housing prices in your market with the Parcl Labs API.

If you’ve been following this series, you’ll know by now that the Parcl Labs API contains layers of enrichment data that can be used to contextualize real estate data and empower users to make more informed decisions. Today we are going to drill down on public sentiment around the housing market using the Parcl Labs API. Get access to the Parcl Labs API today, for free, in three easy steps:

  1. Register for the API
  2. Define the GraphQL query
  3. Call the API and visualize the results

Step 1: Register for the API

If you haven’t registered for the API, check out our first blog which teaches you the basics of querying the Parcl Labs Price Feed or click the button below. If you’ve already registered, move on the step 2!

After you register you will receive an API key giving you access to the Parcl Labs API. The Parcl Labs API leverages GraphQL to give you access to real time real estate data, demographic data and geospatial data to empower users to perform accurate and timely real estate analysis. If you are not familiar with the Parcl Labs API or GraphQL, you can read our documentation to learn more.

You can retrieve API data with only a couple lines of GraphQL code. For demonstration purposes here we will show you a use case using Python, one of the most popular programming languages for data analysis, but the API can be used in combination with your favorite tech stack. Once you’ve received your key, you can store it as a variable in Python along with the API endpoint URL:

Step 2: Define the GraphQL query

In addition to real time real estate, demographic, and geographic data, the Parcl Labs API contains information on housing price sentiment. Housing sentiment is updated daily, and is the average tone of newspaper articles about the housing market in a given geography. Sentiment is another example, along with those written about previously in this series such as income and age, of enrichment data that can deepen one’s understanding of the real estate market.

First we name the query SENTIMENT_PAST_WEEK, and then we can query all MSAs from the MSA table (see the Parcl Labs API docs for a comprehensive list of geographies and objects available in the API).

After defining the level of geography, the columns output from the MSA table are MSA_NAME and PARCL_ID (our unique identifier of different levels of geography). Within the MSA geographies is a nested table, real_estate_events_aggregate, which contains sentiment data and allows users to perform aggregations on the data. The real_estate_events table also is nested within the geography and contains sentiment data, however here we use the _aggregate table so we can take the average tone over the last week. In the example below, sentiment is queried at the geography defined (MSA level) with a parameter of date descending and limit of 7 in order to find average sentiment over the last week. This is what the query would look like:

Step 3: Call the API and visualize the results 

Once you have plugged in your query, the URL and API key you can call the API with Python:

The next step is to flatten the JSON response into a dataframe and calculate the percent difference between the peak and current prices:


#Pull the data into a dataframe and clean/sort sentiment 
SENTIMENT_PAST_WEEK_df = pd.json_normalize(data)

SENTIMENT_PAST_WEEK_df.rename(columns={'real_estate_events_aggregate.aggregate.avg.AVG_TONE': 'Avg Sentiment'}, inplace=True)
SENTIMENT_PAST_WEEK_df['Avg Sentiment'] = SENTIMENT_PAST_WEEK_df['Avg Sentiment'].round(2)
SENTIMENT_PAST_WEEK_df = SENTIMENT_PAST_WEEK_df.sort_values(by=['Avg Sentiment'], ascending=False)

And finally visualize it with your choice of visualization libraries, here we use Plotly:

Based on our parameters, this outputs a bar chart showing the the diverging housing sentiment over the past week for the 20 Case Shiller MSAs (with the exception of Dallas which is currently not available in the pilot version of the API). This allows us to understand where homebuyers are currently feeling the most confident about their respective housing markets, with all data coming from the Parcl Labs API.

Pilot API data is currently in beta and may not exactly match our published content.

Over the past week, we can see that Las Vegas and Denver have had the most positive sentiment around housing prices, with Vegas at the top coming in at 1.99. On the other end of the spectrum New York and Miami have the most negative housing price sentiment, with New York averaging -1.83 over the past week. While this is valuable to track on it’s own, combining sentiment with prices over time allows deeper analysis and unknown connections to be discovered. In an uncertain market, additional market indicators are a helpful aid to buyers, investors and developers insights into where the market is going.

You can register here for early access to our API and start getting insights into your markets well ahead of others.

Check out the full notebook to run this code yourself!

Disclaimer: The material contained on this website is provided for educational and informational purposes only, without any express or implied warranty of any kind. The information on this website does not constitute the provision of investment, tax, legal or other professional advice. No reliance may be placed for any purpose on the information and opinions contained herein or their accuracy or completeness, and nothing contained herein may be relied upon in making any investment decision.

Jason Lewris

Co-Founder

Jason leads the data team at Parcl Labs. Jason brings his experience from Microsoft and Deloitte where he worked on international data standardization and machine learning problems at scale.