Analytics over sampled WFRMLS records¶
WFRMLSAnalytics(client) calculates summaries from property and member responses. It does not request a provider analytics endpoint or paginate through the full market.
Construct the analytics helper¶
from wfrmls import WFRMLSAnalytics, WFRMLSClient
analytics = WFRMLSAnalytics(WFRMLSClient())
summary = analytics.get_market_summary(city="Salt Lake City", days_back=30)
if "error" in summary:
print(summary["error"])
else:
print(summary["inventory"]["active_listings"])
print(summary["pricing"]["median_price"])
Configure WFRMLS_BEARER_TOKEN before the first service access. Check for error before reading report-specific keys: the helpers catch exceptions and return an error dictionary.
Compare the report methods¶
| Method | Parameters and defaults | Result sections |
|---|---|---|
get_market_summary | city=None, days_back=30, property_type=None | inventory, pricing, activity |
analyze_price_trends | city=None, days_back=90, property_type=None, price_segments=5 | overall_pricing, price_segments, market_insights |
generate_agent_performance_report | days_back=90, min_listings=5 | summary, top_agents, sample counts |
get_data_quality_report | No parameters | property_quality, member_quality, score, issues |
Listing summary¶
get_market_summary() requests up to 200 active listings and another 200 active listings filtered by ListingContractDate. It summarizes the records returned, rather than a server-side count or completed sales. Prices use truthy ListPrice values; days on market are computed from parseable contract dates.
The result includes market_area, property_type, analysis_period, timestamp, and:
inventory:active_listings,new_listings, andnew_listings_rate.pricing: mean, median, minimum, maximum, and price range.activity: average computed days on market, the number of dated records, andmarket_velocity(30 / average days).
The date filter currently appends Z to an offset-bearing UTC string, producing text such as ...+00:00Z. A server may reject it; the helper then returns error. This is an implementation limitation, not evidence of current provider behavior.
Price segments, rather than a time series¶
analyze_price_trends() makes one Active-listing request for at most 200 records, selects price/size/date fields, and groups positive prices into sorted segments. days_back labels the report but is not used in a date filter. The result is a sampled price distribution, not historical appreciation or a period-over-period trend.
Use a positive price_segments no larger than the number of valid priced records. Empty segments cause an error dictionary. Missing/zero-size records are excluded from price-per-square-foot calculations.
Agent activity sample¶
generate_agent_performance_report() requests up to 200 recent property records with Member expansion and up to 200 active members. It matches MemberKey, aggregates by MemberFullName, excludes agents below min_listings, and returns the top 10 by listing count, total list value, and mean list price.
This is not a commission, closed-sales, or complete agent-performance report. Members sharing a display name can be grouped together. Its contract-date filter has the same +00:00Z limitation as the listing summary.
Data completeness sample¶
get_data_quality_report() checks up to 50 properties and 30 members. Falsey price, city, bedroom, size, and email values count as missing. It returns GOOD above 0.9, FAIR above 0.7, otherwise NEEDS_ATTENTION.
An empty property sample causes a division-by-zero error that is returned in the error dictionary. The report does not inspect office records, validate source accuracy, or certify data quality beyond these selected fields.
Generated signatures and return details¶
Calculate report dictionaries from sampled property and member responses.
The helpers do not paginate. They generally catch exceptions and return an error dictionary rather than raising. Always check for error before reading report-specific fields. These summaries are not completed-sales, commission, or complete-market measurements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client | Any | WFRMLSClient or a compatible object exposing property and member clients. | required |
Methods:¶
analyze_price_trends ¶
analyze_price_trends(
city: Optional[str] = None,
days_back: int = 90,
property_type: Optional[str] = None,
price_segments: int = 5,
) -> Dict[str, Any]
Segment positive prices from one Active-listing page of up to 200 records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
city | Optional[str] | Optional City filter, default None. | None |
days_back | int | Report label only; it is not used in a date filter, default 90. | 90 |
property_type | Optional[str] | Optional PropertyType filter, default None. | None |
price_segments | int | Positive segment count no larger than valid record count, default 5. | 5 |
Returns:
| Type | Description |
|---|---|
Dict[str, Any] | Dictionary with overall_pricing, price_segments, market_insights, and sample |
Dict[str, Any] | labels/counts; or an error dictionary for missing prices or calculation errors. |
Note
This is a sampled price distribution, not historical appreciation or period-over-period price change. Empty segments cause an error result.
generate_agent_performance_report ¶
generate_agent_performance_report(
days_back: int = 90, min_listings: int = 5
) -> Dict[str, Any]
Aggregate matched member listing activity from two unpaginated samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
days_back | int | Contract-date lookback for properties, default 90. | 90 |
min_listings | int | Minimum sampled listing count for an included agent, default 5. | 5 |
Returns:
| Type | Description |
|---|---|
Dict[str, Any] | Dictionary with summary, top_agents, labels, timestamp, and sample counts; |
Dict[str, Any] | or an error dictionary if requests or calculations fail. |
Note
Retrieves up to 200 properties with Member expansion and 200 active members. Aggregates by MemberFullName after matching MemberKey and returns the top ten by sampled listing count, total list value, and average list price. Duplicate display names can combine agents. The cutoff has the current ...+00:00Z formatting limitation. No commissions or full-market totals are calculated.
get_data_quality_report ¶
get_data_quality_report() -> Dict[str, Any]
Score selected fields in samples of up to 50 properties and 30 members.
Returns:
| Type | Description |
|---|---|
Dict[str, Any] | Dictionary with property_quality, member_quality, overall_quality_score, |
Dict[str, Any] | issues, recommendations, timestamp, and GOOD/FAIR/NEEDS_ATTENTION status; |
Dict[str, Any] | or an error dictionary if retrieval or calculations fail. |
Note
Falsey price, city, bedroom, size, and email values count as missing. An empty property sample causes a caught division-by-zero error. Office records, source accuracy, and complete datasets are not evaluated.
get_market_summary ¶
get_market_summary(
city: Optional[str] = None,
days_back: int = 30,
property_type: Optional[str] = None,
) -> Dict[str, Any]
Summarize up to 200 active and 200 recent-active property records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
city | Optional[str] | Optional City filter, default None. | None |
days_back | int | Contract-date cutoff for the second request, default 30. | 30 |
property_type | Optional[str] | Optional PropertyType filter, default None. | None |
Returns:
| Type | Description |
|---|---|
Dict[str, Any] | Dictionary with inventory, pricing, activity, report labels, and timestamp; |
Dict[str, Any] | or a dictionary containing error if a request or calculation fails. |
Note
This uses active listings, not recent sales or a server-wide count. The contract-date filter currently appends Z to an offset-bearing UTC string such as ...+00:00Z, which a provider may reject. Prices/days on market reflect only records returned in these unpaginated samples.
See property queries for OData behavior and exceptions for failures that other client methods raise directly.