weighted_avg_velocity was a naive mean despite the name — a 500-flat ЖК weighed the same as a 20-flat one. Now count-weighted by flats_total (sql.md AVG principle): Σ(velocity*flats_total)/Σ(flats_total). Competitors with unknown flats_total are excluded from weights; if sizes are unknown for ALL, graceful fallback to the simple mean (den>0 guard). Field name + API contract UNCHANGED (zero consumer ripple — traced: only CompetitorsSummary, no frontend ref). Tests: equal sizes → weighted==naive (existing 6.0 stays); NEW test with 500-flat@40 + 20-flat@2 → 38.54 (not naive 21.0), proving the weighting. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| best_layouts.py | ||
| cadastre_fetch.py | ||
| competitors.py | ||
| custom_pois.py | ||
| filters.py | ||
| future_supply.py | ||
| gate_verdict.py | ||
| layout_signature.py | ||
| layout_velocity_refresh.py | ||
| macro.py | ||
| market_metrics.py | ||
| noise_loader.py | ||
| parser.py | ||
| poi_loader.py | ||
| poi_score.py | ||
| pzz_loader.py | ||
| quarter_dump_lookup.py | ||
| quarter_price_index_refresh.py | ||
| quarter_price_refresh.py | ||
| scorer.py | ||
| supply_layers.py | ||
| velocity.py | ||
| weight_profiles.py | ||