01Run it
Straight from the command's own help.
p202 forecast --metric revenue --horizon 7p202 forecast --metric clicks --history last90 --method linearp202 forecast --metric profit --horizon 14 --method auto --seasonalp202 forecast --all-metrics --horizon 702What you get
Captured from the real binary, run against a demo store with 30 days of traffic. Switch tabs to see the same run as JSON, the shape scripts and agents parse.
$ p202 forecast --metric total_income --interval day --horizon 7 Revenue date lower_bound p10 p25 p50 p75 p90 trend upper_bound ------- ---------- ----------- ------ ------ ------ ------- ------- ----- ----------- 748.42 2026-10-22 133.13 344.18 517.95 722.45 928.99 1352.56 +0.9% 1790.58 752.64 2026-10-23 137.34 348.40 522.17 719.45 962.35 1418.53 1794.79 757.02 2026-10-24 141.73 352.78 526.55 762.98 1033.22 1476.87 1799.18 761.55 2026-10-25 146.25 357.31 531.08 778.46 1091.82 1510.62 1803.70 766.20 2026-10-26 28.93 28.93 535.73 840.67 1175.39 1669.55 1808.36 770.97 2026-10-27 33.70 33.70 540.50 833.96 1185.89 1722.57 1813.13 775.85 2026-10-28 38.58 38.58 545.37 864.43 1190.76 1803.12 1818
$ p202 forecast --metric total_income --interval day --horizon 7 --json { "data": [ { "date": "2026-10-22", "lower_bound": 133.13, "p10": 344.18, "p25": 517.95, "p50": 722.45, "p75": 928.99, "p90": 1352.56, "total_income": 748.42, "trend": "+0.9%", "upper_bound": 1790.58 }, { "date": "2026-10-23", "lower_bound": 137.34, "p10": 348.4, "p25": 522.17, "p50": 719.45, "p75": 962.35, "p90": 1418.53, "total_income": 752.64, "trend": "", "upper_bound": 1794.79 }, { "date": "2026-10-24", "lower_bound": 141.73, "p10": 352.78, "p25": 526.55, "p50": 762.98, "p75": 1033.22, "p90": 1476.87, "total_income": 757.02, "trend": "", "upper_bound": 1799.18 }, { "date": "2026-10-25", "lower_bound": 146.25, "p10": 357.31, "p25": 531.08, "p50": 778.46, "p75": 1091.82, "p90": 1510.62, "total_income": 761.55, "trend": "", "upper_bound": 1803.7 }, { "date": "2026-10-26", "lower_bound": 28.93, "p10": 28.93, "p25": 535.73, "p50": 840.67, "p75": 1175.39, "p90": 1669.55, "total_income": 766.2, "trend": "", "upper_bound": 1808.36 }, { "date": "2026-10-27", "lower_bound": 33.7, "p10": 33.7, "p25": 540.5, "p50": 833.96, "p75": 1185.89, "p90": 1722.57, "total_income": 770.97, "trend": "", "upper_bound": 1813.13 }, { "date": "2026-10-28", "lower_bound": 38.58, "p10": 38.58, "p25": 545.37, "p50": 864.43, "p75": 1190.76, "p90": 1803.12, "total_income": 775.85, "trend": "", "upper_bound": 1818 } ], "meta": { "anomalies_masked": [ "2026-09-21" ], "bounds": "p05-p95 (90%)", "bounds_source": "conformal", "composition": "derived", "data_points_used": 30, "events_active": false, "horizon": 7, "interval": "day", "mae": 288.09, "method": "ensemble", "metric": "total_income", "rmse": 379.94, "seasonal": false, "trend_pct": 0.92, "trend_per_period": 4.571 } }
Forecast revenue, p10 to p90
- 10-22
- 10-23
- 10-24
- 10-25
- 10-26
- 10-27
- 10-28
The band is the 80% range (p10 to p90); the mark is the median. Drawn from the JSON output above.
$ p202 forecast --metric total_income --interval day --horizon 14 --seasonal Revenue date lower_bound p10 p25 p50 p75 p90 trend upper_bound ------- ---------- ----------- ------ ------ ------ ------- ------- ----- ----------- 687.55 2026-10-22 160.48 331.83 435.90 619.23 850.98 1310.04 +4.6% 1787.15 688.21 2026-10-23 161.14 260.05 428.02 571.55 917.27 1352.97 1787.82 688.81 2026-10-24 161.74 260.65 426.95 570.26 968.46 1388.19 1788.41 689.35 2026-10-25 162.28 261.19 427.48 654.58 1013.23 1401.94 1788.95 689.83 2026-10-26 148.57 261.67 427.97 654.21 1023.23 1402.43 1789.44 690.27 2026-10-27 149.01 261.18 428.41 691.64 1063.39 1773.62 1789.87 690.66 2026-10-28 149.40 246.84 428.80 789.75 1063.78 1774.01 1790.27 691.01 2026-10-29 149.75 160.36 424.95 681.41 1064.13 1774.36 1790.62 691.33 2026-10-30 61.13 61.13 414.16 692.31 1064.45 1774.68 1790.94 691.62 2026-10-31 61.42 61.42 371.87 771 1351.88 1774.97 1791.22 691.88 2026-11-01 61.67 61.67 372.13 841.16 1352.14 1775.23 1791.48 692.11 2026-11-02 61.90 61.90 372.36 877.03 1352.37 1775.46 1791.71 692.32 2026-11-03 62.11 62.11 372.57 848.78 1352.58 1775.67 1791.92 692.50 2026-11-04 24.96 24.96 320.39 820.77 1352.77 1775.85 1792.11
$ p202 forecast --metric total_income --interval day --horizon 14 --seasonal --json { "data": [ { "date": "2026-10-22", "lower_bound": 160.48, "p10": 331.83, "p25": 435.9, "p50": 619.23, "p75": 850.98, "p90": 1310.04, "total_income": 687.55, "trend": "+4.6%", "upper_bound": 1787.15 }, { "date": "2026-10-23", "lower_bound": 161.14, "p10": 260.05, "p25": 428.02, "p50": 571.55, "p75": 917.27, "p90": 1352.97, "total_income": 688.21, "trend": "", "upper_bound": 1787.82 }, { "date": "2026-10-24", "lower_bound": 161.74, "p10": 260.65, "p25": 426.95, "p50": 570.26, "p75": 968.46, "p90": 1388.19, "total_income": 688.81, "trend": "", "upper_bound": 1788.41 }, { "date": "2026-10-25", "lower_bound": 162.28, "p10": 261.19, "p25": 427.48, "p50": 654.58, "p75": 1013.23, "p90": 1401.94, "total_income": 689.35, "trend": "", "upper_bound": 1788.95 }, { "date": "2026-10-26", "lower_bound": 148.57, "p10": 261.67, "p25": 427.97, "p50": 654.21, "p75": 1023.23, "p90": 1402.43, "total_income": 689.83, "trend": "", "upper_bound": 1789.44 }, { "date": "2026-10-27", "lower_bound": 149.01, "p10": 261.18, "p25": 428.41, "p50": 691.64, "p75": 1063.39, "p90": 1773.62, "total_income": 690.27, "trend": "", "upper_bound": 1789.87 }, { "date": "2026-10-28", "lower_bound": 149.4, "p10": 246.84, "p25": 428.8, "p50": 789.75, "p75": 1063.78, "p90": 1774.01, "total_income": 690.66, "trend": "", "upper_bound": 1790.27 }, { "date": "2026-10-29", "lower_bound": 149.75, "p10": 160.36, "p25": 424.95, "p50": 681.41, "p75": 1064.13, "p90": 1774.36, "total_income": 691.01, "trend": "", "upper_bound": 1790.62 }, { "date": "2026-10-30", "lower_bound": 61.13, "p10": 61.13, "p25": 414.16, "p50": 692.31, "p75": 1064.45, "p90": 1774.68, "total_income": 691.33, "trend": "", "upper_bound": 1790.94 }, { "date": "2026-10-31", "lower_bound": 61.42, "p10": 61.42, "p25": 371.87, "p50": 771, "p75": 1351.88, "p90": 1774.97, "total_income": 691.62, "trend": "", "upper_bound": 1791.22 }, { "date": "2026-11-01", "lower_bound": 61.67, "p10": 61.67, "p25": 372.13, "p50": 841.16, "p75": 1352.14, "p90": 1775.23, "total_income": 691.88, "trend": "", "upper_bound": 1791.48 }, { "date": "2026-11-02", "lower_bound": 61.9, "p10": 61.9, "p25": 372.36, "p50": 877.03, "p75": 1352.37, "p90": 1775.46, "total_income": 692.11, "trend": "", "upper_bound": 1791.71 }, { "date": "2026-11-03", "lower_bound": 62.11, "p10": 62.11, "p25": 372.57, "p50": 848.78, "p75": 1352.58, "p90": 1775.67, "total_income": 692.32, "trend": "", "upper_bound": 1791.92 }, { "date": "2026-11-04", "lower_bound": 24.96, "p10": 24.96, "p25": 320.39, "p50": 820.77, "p75": 1352.77, "p90": 1775.85, "total_income": 692.5, "trend": "", "upper_bound": 1792.11 } ], "meta": { "bounds": "p05-p95 (90%)", "bounds_source": "conformal", "data_points_used": 31, "events_active": false, "horizon": 14, "interval": "day", "mae": 325.13, "method": "ensemble", "metric": "total_income", "rmse": 405.34, "seasonal": true, "seasonal_applied": false, "trend_pct": 4.61, "trend_per_period": 22.8145, "weights": { "holtwinters": 0.341, "sma": 0.329, "wma": 0.33 } } }
03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 forecastSet flags below; the command updates as you type.
04Flags
24 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --aff-campaign-idstring | Filter by campaign ID |
| --aff-network-idstring | Filter by affiliate network ID |
| --all-metricsbool | Forecast clicks, leads, income, cost, and net together via ratio decomposition (coherent output) |
| --anomaly-cyclesint · default 4 | Seasonal cycles on each side used as same-weekday/hour references for transient masking |
| --anomaly-sigmafloat64 · default 5 | Transient-masking threshold in robust sigma units (lower masks more aggressively) |
| --confidencefloat64 · default 0.95 | Confidence level for prediction bounds; snaps to the nearest band: 0.50 (p25-p75), 0.80 (p10-p90), or 0.90 (p05-p95, also used for 0.95/0.99) |
| --country-idstring | Filter by country ID |
| --daysstring | Alias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltimetodayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime |
| --event-tagstring | Filter forecast events by tag (comma-separated, e.g. us-holidays,promos) |
| --eventsbool | Enable event-aware forecasting using stored forecast events |
| --historystring · default last90 | Historical data period (aliases: --period, --days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltimetodayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime |
| --horizon, -nint · default 7 | Number of periods to forecast forward |
| --interval, -istring · default day | Forecast granularity: hour, day, week, monthhourdayweekmonth |
| --landing-page-idstring | Filter by landing page ID |
| --methodstring · default auto | Forecasting method (auto = ensemble): linear, sma, wma, holtwinters, ensemble, autolinearsmawmaholtwintersensembleauto |
| --metric, -mstring | Metric to forecast: total_clicks, total_click_throughs, total_leads, total_income, total_cost, total_net, epc, avg_cpc, conv_rate, roi, cpa (aliases: clicks=total_clicks, conversions=total_leads, cost=total_cost, income=total_income, leads=total_leads, net=total_net, profit=total_net, revenue=total_income)total_clickstotal_click_throughstotal_leadstotal_incometotal_costtotal_netepcavg_cpcconv_rateroicpaclicks → total_clicksconversions → total_leadscost → total_costincome → total_incomeleads → total_leadsnet → total_netprofit → total_netrevenue → total_income |
| --no-anomaly-maskbool | Disable transient masking (fit short outlier runs such as tracking outages as data) |
| --no-level-shiftbool | Disable level-shift detection (fit the full history as-is) |
| --periodstring | Alias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltimetodayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime |
| --ppc-account-idstring | Filter by PPC account ID |
| --ppc-network-idstring | Filter by PPC network ID |
| --seasonalbool | Apply a day-of-week profile learned from the fetched history (hour interval also gets an hour-of-day profile) |
| --seasonal-monthlybool | Apply day-of-month seasonal adjustment learned from the fetched series (requires --interval day) |
| --windowint | SMA/WMA window size (0 = auto-select) |
05How it works
Forecast future values for any tracked metric using statistical methods.
Fetches historical time-series data from your Prosper202 instance and projects it forward using the selected algorithm. Supports linear regression, simple and weighted moving averages, damped-trend Holt-Winters exponential smoothing, and an ensemble (the default, alias "auto") that combines the methods weighted by rolling-backtest accuracy and reports each member's share.
With --seasonal, predictions are modulated by a day-of-week profile learned from the fetched history itself (re-estimated inside every backtest fold, so the bands describe the profiled forecast) to account for weekly patterns (e.g., "Tuesdays always convert better"). Requires --interval day or hour.
Event-aware forecasting (--events, --event-tag) uses stored calendar events and requires --interval day.
Derived metrics (leads, income, cost, net) requested without --seasonal or --events are composed from driver forecasts (clicks and the linking rates), so leads = clicks x conv_rate, income = leads x avg_payout, and net = income - cost hold exactly; --all-metrics forecasts all core metrics together this way.
Bounds are empirical quantiles from a rolling backtest (meta "bounds" names the pair, e.g. p05-p95 (90%)); short histories fall back to Gaussian bounds (meta "bounds_source"). Short outlier runs such as a tracking outage are masked from fitting and listed in meta "anomalies_masked"; a detected level shift is reported as "level_shift_at" and the new regime is fitted. Use --no-anomaly-mask / --no-level-shift to fit the history exactly as-is.
Examples: p202 forecast --metric revenue --horizon 7 p202 forecast --metric clicks --history last90 --method linear p202 forecast --metric profit --horizon 14 --method auto --seasonal p202 forecast --all-metrics --horizon 7 p202 forecast --metric conv_rate --history last30 --interval week --horizon 4 p202 forecast --metric revenue --aff-campaign-id 5 --horizon 7 p202 forecast --metric revenue --events --horizon 14 p202 forecast --metric clicks --events --event-tag us-holidays p202 forecast --metric clicks --no-anomaly-mask --json
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands forecast --json. - With
AI_AGENT,CLAUDECODEor another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with ahint. - Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure, 6 no Pro licence on the install.
{
"path": "p202 forecast",
"use": "forecast",
"short": "Forecast future performance metrics using historical data",
"long": "Forecast future values for any tracked metric using statistical methods.\n\nFetches historical time-series data from your Prosper202 instance and projects\nit forward using the selected algorithm. Supports linear regression, simple\nand weighted moving averages, damped-trend Holt-Winters exponential smoothing,\nand an ensemble (the default, alias \"auto\") that combines the methods weighted\nby rolling-backtest accuracy and reports each member's share.\n\nWith --seasonal, predictions are modulated by a day-of-week profile learned\nfrom the fetched history itself (re-estimated inside every backtest fold, so\nthe bands describe the profiled forecast) to account for weekly patterns\n(e.g., \"Tuesdays always convert better\"). Requires --interval day or hour.\n\nEvent-aware forecasting (--events, --event-tag) uses stored calendar events and\nrequires --interval day.\n\nDerived metrics (leads, income, cost, net) requested without --seasonal or\n--events are composed from driver forecasts (clicks and the linking rates),\nso leads = clicks x conv_rate, income = leads x avg_payout, and net =\nincome - cost hold exactly; --all-metrics forecasts all core metrics\ntogether this way.\n\nBounds are empirical quantiles from a rolling backtest (meta \"bounds\" names\nthe pair, e.g. p05-p95 (90%)); short histories fall back to Gaussian bounds\n(meta \"bounds_source\"). Short outlier runs such as a tracking outage are\nmasked from fitting and listed in meta \"anomalies_masked\"; a detected level\nshift is reported as \"level_shift_at\" and the new regime is fitted. Use\n--no-anomaly-mask / --no-level-shift to fit the history exactly as-is.\n\nExamples:\n p202 forecast --metric revenue --horizon 7\n p202 forecast --metric clicks --history last90 --method linear\n p202 forecast --metric profit --horizon 14 --method auto --seasonal\n p202 forecast --all-metrics --horizon 7\n p202 forecast --metric conv_rate --history last30 --interval week --horizon 4\n p202 forecast --metric revenue --aff-campaign-id 5 --horizon 7\n p202 forecast --metric revenue --events --horizon 14\n p202 forecast --metric clicks --events --event-tag us-holidays\n p202 forecast --metric clicks --no-anomaly-mask --json",
"aliases": [
"predict"
],
"runnable": true,
"flags": [
{
"name": "aff-campaign-id",
"type": "string",
"default": "",
"usage": "Filter by campaign ID",
"required": false
},
{
"name": "aff-network-id",
"type": "string",
"default": "",
"usage": "Filter by affiliate network ID",
"required": false
},
{
"name": "all-metrics",
"type": "bool",
"default": "false",
"usage": "Forecast clicks, leads, income, cost, and net together via ratio decomposition (coherent output)",
"required": false
},
{
"name": "anomaly-cycles",
"type": "int",
"default": "4",
"usage": "Seasonal cycles on each side used as same-weekday/hour references for transient masking",
"required": false
},
{
"name": "anomaly-sigma",
"type": "float64",
"default": "5",
"usage": "Transient-masking threshold in robust sigma units (lower masks more aggressively)",
"required": false
},
{
"name": "confidence",
"type": "float64",
"default": "0.95",
"usage": "Confidence level for prediction bounds; snaps to the nearest band: 0.50 (p25-p75), 0.80 (p10-p90), or 0.90 (p05-p95, also used for 0.95/0.99)",
"required": false
},
{
"name": "country-id",
"type": "string",
"default": "",
"usage": "Filter by country ID",
"required": false
},
{
"name": "days",
"type": "string",
"default": "",
"usage": "Alias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
"allowed_values": [
"today",
"yesterday",
"last7",
"last14",
"last30",
"last90",
"thismonth",
"lastmonth",
"thisyear",
"lastyear",
"alltime"
],
"required": false
},
{
"name": "event-tag",
"type": "string",
"default": "",
"usage": "Filter forecast events by tag (comma-separated, e.g. us-holidays,promos)",
"required": false
},
{
"name": "events",
"type": "bool",
"default": "false",
"usage": "Enable event-aware forecasting using stored forecast events",
"required": false
},
{
"name": "history",
"type": "string",
"default": "last90",
"usage": "Historical data period (aliases: --period, --days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
"allowed_values": [
"today",
"yesterday",
"last7",
"last14",
"last30",
"last90",
"thismonth",
"lastmonth",
"thisyear",
"lastyear",
"alltime"
],
"required": false
},
{
"name": "horizon",
"shorthand": "n",
"type": "int",
"default": "7",
"usage": "Number of periods to forecast forward",
"required": false
},
{
"name": "interval",
"shorthand": "i",
"type": "string",
"default": "day",
"usage": "Forecast granularity: hour, day, week, month",
"allowed_values": [
"hour",
"day",
"week",
"month"
],
"required": false
},
{
"name": "landing-page-id",
"type": "string",
"default": "",
"usage": "Filter by landing page ID",
"required": false
},
{
"name": "method",
"type": "string",
"default": "auto",
"usage": "Forecasting method (auto = ensemble): linear, sma, wma, holtwinters, ensemble, auto",
"allowed_values": [
"linear",
"sma",
"wma",
"holtwinters",
"ensemble",
"auto"
],
"required": false
},
{
"name": "metric",
"shorthand": "m",
"type": "string",
"default": "",
"usage": "Metric to forecast: total_clicks, total_click_throughs, total_leads, total_income, total_cost, total_net, epc, avg_cpc, conv_rate, roi, cpa (aliases: clicks=total_clicks, conversions=total_leads, cost=total_cost, income=total_income, leads=total_leads, net=total_net, profit=total_net, revenue=total_income)",
"allowed_values": [
"total_clicks",
"total_click_throughs",
"total_leads",
"total_income",
"total_cost",
"total_net",
"epc",
"avg_cpc",
"conv_rate",
"roi",
"cpa"
],
"value_aliases": {
"clicks": "total_clicks",
"conversions": "total_leads",
"cost": "total_cost",
"income": "total_income",
"leads": "total_leads",
"net": "total_net",
"profit": "total_net",
"revenue": "total_income"
},
"required": false
},
{
"name": "no-anomaly-mask",
"type": "bool",
"default": "false",
"usage": "Disable transient masking (fit short outlier runs such as tracking outages as data)",
"required": false
},
{
"name": "no-level-shift",
"type": "bool",
"default": "false",
"usage": "Disable level-shift detection (fit the full history as-is)",
"required": false
},
{
"name": "period",
"type": "string",
"default": "",
"usage": "Alias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
"allowed_values": [
"today",
"yesterday",
"last7",
"last14",
"last30",
"last90",
"thismonth",
"lastmonth",
"thisyear",
"lastyear",
"alltime"
],
"required": false
},
{
"name": "ppc-account-id",
"type": "string",
"default": "",
"usage": "Filter by PPC account ID",
"required": false
},
{
"name": "ppc-network-id",
"type": "string",
"default": "",
"usage": "Filter by PPC network ID",
"required": false
},
{
"name": "seasonal",
"type": "bool",
"default": "false",
"usage": "Apply a day-of-week profile learned from the fetched history (hour interval also gets an hour-of-day profile)",
"required": false
},
{
"name": "seasonal-monthly",
"type": "bool",
"default": "false",
"usage": "Apply day-of-month seasonal adjustment learned from the fetched series (requires --interval day)",
"required": false
},
{
"name": "window",
"type": "int",
"default": "0",
"usage": "SMA/WMA window size (0 = auto-select)",
"required": false
}
]
}