/api/forecast_cost

Header
X-Customer-Api-Id: <uuid>
X-Secret: <secret>
Content-Type: application/json
Request Body Schema
{
  "forecast_period": int,    // ≥1, number of months to predict (e.g., 3, 6, 12)
  "data": [                  // Historic daily cost series (≥45 rows recommended)
    {
      "date": "YYYY-MM-DD",  // ISO date; missing days auto-filled with cost=0
      "cost": number         // Daily cost (same currency; negatives allowed)
    }
    // … additional records …
  ]
}
Example Request Body
// Example Request
{
  "forecast_period": 6,
  "data": [
    { "date": "2025-01-01", "cost": 1100.00 },
    { "date": "2025-01-02", "cost": 1112.00 },
    { "date": "2025-01-03", "cost": 1118.00 },
    { "date": "2025-01-04", "cost": 1083.00 },
    { "date": "2025-01-05", "cost": 1078.00 },
    // … (at least 45 total entries) …
    { "date": "2025-03-30", "cost": 1448.00 }
  ]
}
Example Response Body
// Example Response
{
  "forecast_period": 6,
  "forecast_result": {
    "analysis_type": "generic_cost",
    "best_algorithm": "Aggregation",
    "evaluation_metrics": {
      "RMSE": 31.87128,
      "MAE": 26.72329,
      "R2": 0.22558,
      "average_daily_cost": 1466.30524,
      "Interpretation": "Aggregation selected (RMSE=31.87, MAE=26.72, R²=0.23)."
    },
    "forecast": {
      "calendar": [
        { "yyyy-mm": "2025-04", "value": 45003.1259 },
        { "yyyy-mm": "2025-05", "value": 46503.2301 },
        { "yyyy-mm": "2025-06", "value": 45003.1259 },
        { "yyyy-mm": "2025-07", "value": 46503.2301 },
        { "yyyy-mm": "2025-08", "value": 46503.2301 },
        { "yyyy-mm": "2025-09", "value": 45003.1259 }
      ],
      "business": [
        { "yyyy-mm": "2025-04", "value": 33002.2923 },
        { "yyyy-mm": "2025-05", "value": 33002.2923 },
        { "yyyy-mm": "2025-06", "value": 31502.1881 },
        { "yyyy-mm": "2025-07", "value": 34502.3965 },
        { "yyyy-mm": "2025-08", "value": 31502.1881 },
        { "yyyy-mm": "2025-09", "value": 33002.2923 }
      ]
    }
  },
  "execution_time_seconds": 0.2536935806
}
Description

Forecast daily total cost (COGS, OPEX, or any cost series) out to a multi-month horizon. The endpoint auto-benchmarks ARIMA, ETS, Prophet, TBATS, tree-based ML, and aggregation defaults, selects the lowest-error model, and returns month-level calendar and business-day forecasts with diagnostics.

Business Usage

• Cash-flow Planning & Treasury: Model daily burn-rate vs. budget for funding and hedging. • Finance Model Validation: Automate model selection to ensure trust in forecasts. • GL Accruals & Staffing: Use business-day series for payroll, AP accruals, and headcount planning. Perguntar ao ChatGPT

← Back to all routes