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 ------- ---------- ----------- --- ------ ------ ------- ------- ----- ----------- 566.44 2026-10-10 0 0 141.35 461.83 900.04 1271.80 +0.1% 1646.30 566.76 2026-10-11 0 0 141.67 527.67 900.36 1306.08 1646.62 567.18 2026-10-12 0 0 0 591 997.38 1306.50 1647.04 567.69 2026-10-13 0 0 0 499.52 1055.71 1446.37 1647.55 568.27 2026-10-14 0 0 0 491.55 1056.29 1446.95 1648.13 568.92 2026-10-15 0 0 0 552.97 1258.50 1447.61 1648.78 569.63 2026-10-16 0 0 0 274.18 1259.21 1448.31 1649.49
$ p202 forecast --metric total_income --interval day --horizon 7 --json { "data": [ { "date": "2026-10-10", "lower_bound": 0, "p10": 0, "p25": 141.35, "p50": 461.83, "p75": 900.04, "p90": 1271.8, "total_income": 566.44, "trend": "+0.1%", "upper_bound": 1646.3 }, { "date": "2026-10-11", "lower_bound": 0, "p10": 0, "p25": 141.67, "p50": 527.67, "p75": 900.36, "p90": 1306.08, "total_income": 566.76, "trend": "", "upper_bound": 1646.62 }, { "date": "2026-10-12", "lower_bound": 0, "p10": 0, "p25": 0, "p50": 591, "p75": 997.38, "p90": 1306.5, "total_income": 567.18, "trend": "", "upper_bound": 1647.04 }, { "date": "2026-10-13", "lower_bound": 0, "p10": 0, "p25": 0, "p50": 499.52, "p75": 1055.71, "p90": 1446.37, "total_income": 567.69, "trend": "", "upper_bound": 1647.55 }, { "date": "2026-10-14", "lower_bound": 0, "p10": 0, "p25": 0, "p50": 491.55, "p75": 1056.29, "p90": 1446.95, "total_income": 568.27, "trend": "", "upper_bound": 1648.13 }, { "date": "2026-10-15", "lower_bound": 0, "p10": 0, "p25": 0, "p50": 552.97, "p75": 1258.5, "p90": 1447.61, "total_income": 568.92, "trend": "", "upper_bound": 1648.78 }, { "date": "2026-10-16", "lower_bound": 0, "p10": 0, "p25": 0, "p50": 274.18, "p75": 1259.21, "p90": 1448.31, "total_income": 569.63, "trend": "", "upper_bound": 1649.49 } ], "meta": { "anomalies_masked": [ "2026-09-27" ], "bounds": "p05-p95 (90%)", "bounds_source": "conformal", "composition": "derived", "data_points_used": 29, "events_active": false, "horizon": 7, "interval": "day", "mae": 433.68, "method": "ensemble", "metric": "total_income", "rmse": 518.55, "seasonal": false, "trend_pct": 0.1, "trend_per_period": 0.5316 } }
Forecast revenue, p10 to p90
- 10-10
- 10-11
- 10-12
- 10-13
- 10-14
- 10-15
- 10-16
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 ------- ---------- ----------- --- ------ ------ ------- ------- ----- ----------- 540.06 2026-10-10 0 0 133.38 511.52 881.14 1184.39 +1.0% 1590.05 540.14 2026-10-11 0 0 133.47 537.63 1098.02 1184.47 1590.14 540.21 2026-10-12 0 0 126.11 550.14 1098.09 1184.54 1590.21 540.27 2026-10-13 0 0 126.17 515.99 1098.15 1184.60 1590.26 540.32 2026-10-14 0 0 126.22 749.03 1098.20 1185.42 1590.31 540.36 2026-10-15 0 0 92.83 601.14 1162.67 1349.18 1590.36 540.40 2026-10-16 0 0 64.80 555.58 1162.71 1349.22 1590.39 540.43 2026-10-17 0 0 64.83 671.15 1162.74 1449.56 1590.42 540.45 2026-10-18 0 0 64.86 419.43 1162.76 1551.51 1590.45 540.48 2026-10-19 0 0 64.88 635.72 1162.79 1551.54 1590.47 540.50 2026-10-20 0 0 64.90 701.61 1162.81 1551.56 1590.49 540.51 2026-10-21 0 0 64.92 589.01 1186.08 1551.57 1590.51 540.53 2026-10-22 0 0 64.93 511.74 1186.09 1648.39 1648.39 540.54 2026-10-23 0 0 64.94 513.11 1445.95 1648.40 1648.40
$ p202 forecast --metric total_income --interval day --horizon 14 --seasonal --json { "data": [ { "date": "2026-10-10", "lower_bound": 0, "p10": 0, "p25": 133.38, "p50": 511.52, "p75": 881.14, "p90": 1184.39, "total_income": 540.06, "trend": "+1.0%", "upper_bound": 1590.05 }, { "date": "2026-10-11", "lower_bound": 0, "p10": 0, "p25": 133.47, "p50": 537.63, "p75": 1098.02, "p90": 1184.47, "total_income": 540.14, "trend": "", "upper_bound": 1590.14 }, { "date": "2026-10-12", "lower_bound": 0, "p10": 0, "p25": 126.11, "p50": 550.14, "p75": 1098.09, "p90": 1184.54, "total_income": 540.21, "trend": "", "upper_bound": 1590.21 }, { "date": "2026-10-13", "lower_bound": 0, "p10": 0, "p25": 126.17, "p50": 515.99, "p75": 1098.15, "p90": 1184.6, "total_income": 540.27, "trend": "", "upper_bound": 1590.26 }, { "date": "2026-10-14", "lower_bound": 0, "p10": 0, "p25": 126.22, "p50": 749.03, "p75": 1098.2, "p90": 1185.42, "total_income": 540.32, "trend": "", "upper_bound": 1590.31 }, { "date": "2026-10-15", "lower_bound": 0, "p10": 0, "p25": 92.83, "p50": 601.14, "p75": 1162.67, "p90": 1349.18, "total_income": 540.36, "trend": "", "upper_bound": 1590.36 }, { "date": "2026-10-16", "lower_bound": 0, "p10": 0, "p25": 64.8, "p50": 555.58, "p75": 1162.71, "p90": 1349.22, "total_income": 540.4, "trend": "", "upper_bound": 1590.39 }, { "date": "2026-10-17", "lower_bound": 0, "p10": 0, "p25": 64.83, "p50": 671.15, "p75": 1162.74, "p90": 1449.56, "total_income": 540.43, "trend": "", "upper_bound": 1590.42 }, { "date": "2026-10-18", "lower_bound": 0, "p10": 0, "p25": 64.86, "p50": 419.43, "p75": 1162.76, "p90": 1551.51, "total_income": 540.45, "trend": "", "upper_bound": 1590.45 }, { "date": "2026-10-19", "lower_bound": 0, "p10": 0, "p25": 64.88, "p50": 635.72, "p75": 1162.79, "p90": 1551.54, "total_income": 540.48, "trend": "", "upper_bound": 1590.47 }, { "date": "2026-10-20", "lower_bound": 0, "p10": 0, "p25": 64.9, "p50": 701.61, "p75": 1162.81, "p90": 1551.56, "total_income": 540.5, "trend": "", "upper_bound": 1590.49 }, { "date": "2026-10-21", "lower_bound": 0, "p10": 0, "p25": 64.92, "p50": 589.01, "p75": 1186.08, "p90": 1551.57, "total_income": 540.51, "trend": "", "upper_bound": 1590.51 }, { "date": "2026-10-22", "lower_bound": 0, "p10": 0, "p25": 64.93, "p50": 511.74, "p75": 1186.09, "p90": 1648.39, "total_income": 540.53, "trend": "", "upper_bound": 1648.39 }, { "date": "2026-10-23", "lower_bound": 0, "p10": 0, "p25": 64.94, "p50": 513.11, "p75": 1445.95, "p90": 1648.4, "total_income": 540.54, "trend": "", "upper_bound": 1648.4 } ], "meta": { "bounds": "p05-p95 (90%)", "bounds_source": "conformal", "data_points_used": 31, "events_active": false, "horizon": 14, "interval": "day", "mae": 379.14, "method": "ensemble", "metric": "total_income", "rmse": 445.83, "seasonal": true, "seasonal_applied": false, "trend_pct": 1.04, "trend_per_period": 5.3131, "weights": { "holtwinters": 0.361, "sma": 0.331, "wma": 0.308 } } }
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.
{
"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
}
]
}