Implementation of Price Prediction
Price forecasting applies to vastly different contexts: predicting commodity prices for production planning, real estate price forecasting for appraisal, predicting financial asset movements. Each domain has specifics, but general methodological principles are unified.
Typology of Price Prediction Tasks
Commodity Markets: Oil, gas, metals, agricultural products. Factors: futures curves, inventories, geopolitics, weather. Horizon: 1-12 months.
Real Estate: Valuing specific property (hedonic pricing model) or forecasting market index. Horizon: 3-24 months.
Financial Assets: Stocks, currencies, cryptocurrencies. Most competitive environment — EMH (Efficient Market Hypothesis) limits predictability. Practical horizon: 1-30 days.
Retail Prices: Predicting optimal price to maximize revenue/margin considering price elasticity.
General Methodology
Breaking Price into Components:
- Long-term trend (autocorrelation, macro factors)
- Seasonality (annual, quarterly, intra-week)
- Cyclicity (business cycles)
- Remainder (irregular events, noise)
STL/MSTL decomposition — first step in analyzing any price series.
Hedonic Pricing for Real Estate
Most practical implementation — valuation model:
Features:
- Property characteristics: area, rooms, floor, year built, material
- Location: distance to metro, schools, center; crime index; school district rating
- Infrastructure: proximity scores to shops, parks, hospitals
- Market conditions: comparable sales in last 6-12 months
Models:
- XGBoost / LightGBM: best accuracy for tabular data
- Random Forest: lower accuracy, more stable
- Spatial regression (kriging): accounts for spatial price autocorrelation
Modern hedonic model accuracy: MAPE 5-12% for residential real estate in cities with good data.
Commodity Price Forecasting
Oil Model (Example):
Features:
- Futures curve slope (contango/backwardation)
- EIA crude oil inventories (weekly)
- Baker Hughes rig count
- USD Index (DXY)
- Geopolitical risk index (NLP from news)
- Lagged price series: t-1, t-7, t-30, t-365
LightGBM with rolling cross-validation. MAPE 3-8% on weekly horizon — acceptable result. At 3-month horizon, error grows to 15-25%.
Look-ahead bias problem: all features must be available at prediction time. Futures curve at time t — OK. Current week inventory data — no (published with delay).
Price Elasticity and Retail Pricing
Not forecasting future market price, but finding optimal price to maximize revenue:
Elasticity Model:
log(Demand) = α + β × log(Price) + γ × log(Competitor_Price) + δ × Promotions + ε
β — price elasticity coefficient. Typically -0.5 to -3.0 depending on category.
Dynamic Pricing Model:
- LightGBM predicts demand at different price points
- Optimizer (scipy.optimize) finds price = argmax(Price × Demand(Price))
- Constraints: min/max price, MSRP, brand price image
Bayesian Optimization enables exploring price space without harming revenue during learning.
Integration and Updates
- Retail: integration with pricing engine (Revionics, Wiser, custom) via API
- Commodities: export forecasts to ERP/Treasury system for hedging
- Real Estate: REST API for AVM (Automated Valuation Model), CRM integration for agencies
Monitoring: track MAPE on rolling 30-day window. On degradation > 30% — automatic retraining.
Timeline: hedonic model for real estate or commodity price forecast — 4-6 weeks. Retail dynamic pricing with price elasticity and A/B testing — 3-4 months.







