/api/forecast_cost_improved

Header
X-Customer-Api-Id: <uuid>
X-Secret: <secret>
Content-Type: application/json
Request Body Schema
{
  "forecast_period": int,    // ≥1, months to project (e.g., 9; supports up to 12)
  "data": [                  // Historic daily cost series (≥60 rows recommended)
    {
      "date": "YYYY-MM-DD",  // ISO date; gaps auto-filled with cost=0
      "cost": number         // Daily cost amount (currency‐agnostic)
    }
    // … additional records …
  ]
}
Example Request Body
// Example Request
{
  "forecast_period": 9,
  "data": [
    { "date": "2024-10-01", "cost": 950.00 },
    { "date": "2024-10-02", "cost": 956.00 },
    { "date": "2024-10-03", "cost": 962.00 },
    { "date": "2024-10-04", "cost": 968.00 },
    { "date": "2024-10-05", "cost": 921.00 },
    // … (at least 60 entries covering seasonality) …
    { "date": "2025-03-31", "cost": 1468.00 }
  ]
}
Example Response Body
// Example Response
{
  "forecast_period": 9,
  "forecast_result": {
    "analysis_type": "generic_cost",
    "best_algorithm": "Aggregation",
    "evaluation_metrics": {
      "RMSE": 26.57218,
      "MAE": 21.84404,
      "R2": 0.66663,
      "average_daily_cost": 1382.57752,
      "Interpretation": "Aggregation selected (RMSE=26.57, MAE=21.84, R²=0.67)."
    },
    "forecast": {
      "calendar": [
        { "yyyy-mm": "2025-04", "value": 43445.6058 },
        { "yyyy-mm": "2025-05", "value": 44893.7926 },
        { "yyyy-mm": "2025-06", "value": 43445.6058 },
        { "yyyy-mm": "2025-07", "value": 44893.7926 },
        { "yyyy-mm": "2025-08", "value": 44893.7926 },
        { "yyyy-mm": "2025-09", "value": 43445.6058 },
        { "yyyy-mm": "2025-10", "value": 44893.7926 },
        { "yyyy-mm": "2025-11", "value": 43445.6058 },
        { "yyyy-mm": "2025-12", "value": 44893.7926 }
      ],
      "business": [
        { "yyyy-mm": "2025-04", "value": 31860.1109 },
        { "yyyy-mm": "2025-05", "value": 31860.1109 },
        { "yyyy-mm": "2025-06", "value": 30411.9240 },
        { "yyyy-mm": "2025-07", "value": 33308.2978 },
        { "yyyy-mm": "2025-08", "value": 30411.9240 },
        { "yyyy-mm": "2025-09", "value": 31860.1109 },
        { "yyyy-mm": "2025-10", "value": 33308.2978 },
        { "yyyy-mm": "2025-11", "value": 28963.7372 },
        { "yyyy-mm": "2025-12", "value": 33308.2978 }
      ]
    },
    "business_indicators": {
      "historical_average_cost": 1194.37,
      "historical_cost_std": 157.88,
      "historical_coefficient_of_variation": 0.13,
      "historical_trend_slope": 4.783,
      "historical_trend_direction": "increasing",
      "forecast_cumulative_cost_calendar": 398251.39,
      "forecast_average_daily_cost_calendar": 1475.01,
      "forecast_cumulative_cost_business": 285292.81,
      "forecast_average_daily_cost_business": 1509.49,
      "forecast_growth_percentage": 23.5
    }
  },
  "execution_time_seconds": 0.255337
}
Description

An extended 9-month daily cost forecaster that auto-benchmarks time-series (ARIMA, ETS, Prophet, TBATS) and tree-ML models, selects the champion by RMSE, and returns calendar & business-day forecasts plus key business indicators (trend, volatility, growth) for Finance & FP&A dashboards.

Business Usage

• Long-Horizon Planning: Project up to 12 months of COGS/OPEX for treasury and cash-flow models. • Dashboard Health Read-Out: Business Indicators block surfaces trend direction, volatility, and growth %. • Staffing & Accruals: Use business-day forecasts for workforce planning and AP accruals; calendar view for top-line burn analysis.

← Back to all routes