Analytics: Forecast cash flow
forecast_cash_flow Project cash flow for the next N months based on recent patterns.
Uses 3-month averages of income and expenses as a baseline AND
biases each future month by recurring templates the user has
scheduled but that haven't fired yet (Phase 115). Templates that
have already fired at least once are folded into the historical
baseline, so they're not counted twice.
Each projection row carries ``scheduled_income_added`` and
``scheduled_expenses_added``, which separate the part of the
projection that comes from "what's already happening" from
"what's scheduled to start." The top-level
``scheduled_templates_count`` is the number of un-fired templates
contributing to the bias — when 0, the projection is purely
historical.
Args:
months_ahead: Number of months to project (default 3, max 12).
Values <= 0 return a validation error; values > 12 are clamped
to 12 and the response sets clamped_months_ahead=true while
requested_months_ahead echoes the original input.
account_id: Optional - project for a specific account only
Returns:
Current balance, average monthly income/expenses/net,
monthly projections (each with the scheduled-bias breakout),
``scheduled_templates_count``, and a human-readable note.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | No | ||
| months_ahead | No |