DECCF · Cash Flow Modeler and Calculator

Time, phases, and schedules

Timeline

Create a timeline with periods.daily, .weekly, .monthly, .quarterly, or .annual:

from accepts YYYY-MM or YYYY-MM-DD. count must be a positive integer. Optional projection must be a non-negative integer. Calendars generate period-start dates. The runtime calculates projection periods, but published dates, series, and metric values are currently limited to count; do not use projection to request more public result periods.

Dates are validated strictly against the UTC calendar. YYYY-MM means the first day of that month. input.date() and date-valued derived() references can be used for timeline starts and schedule dates resolved during compilation.

Phases

phase({ from, to }) declares an inclusive date range. Add the reference to the model's phases map under a name. Phases must fit inside the timeline, cannot overlap, and each period can belong to at most one phase. ctx.inPhase(phaseRef) checks whether a phase is active.

Schedules can use schedule.phaseStart, .phaseEnter, or .phaseEnd. Start and enter are placed at the first represented period; end is placed in the last period.

Schedules

  • schedule.once(date, { placement? })
  • schedule.onceAfterNoOfDays(days) for a cashflow that subscribes to a trigger
  • schedule.every(frequency, { from?, to?, interval?, placement?, except?, also?, dayOfMonth?, endOfMonth? })
  • Convenience factories: daily, weekly, monthly, quarterly, annual, yearEnd
  • schedule.yearEnd({ from?, to?, placement?, except?, also? }) places one occurrence on December 31 in each represented calendar year.
  • Monthly rules: dayOfMonth from 1 to 31, clamped to month length, or endOfMonth: true

from and to are inclusive. They can be fixed dates, date inputs, or date-valued derived references. A month in to includes the whole month. except removes dates and also adds dates. Schedule occurrences map to model periods; a model cannot represent events finer than its calendar. For example, a monthly timeline cannot preserve separate daily occurrences.

placement is start, mid, or end. A one-time schedule without placement preserves the exact date's position in the period. Recurring periods default to end placement. Placement affects valuation timing such as NPV and IRR.

onceAfterNoOfDays requires the cashflow to receive a trigger emitted by a source cashflow with the same reference in triggers. The delay must be a positive integer and is counted from the source occurrence's scheduled placement. The due date is mapped to a timeline period and moved to at least the next period after the source; use a daily timeline for day-level precision. A due date outside the timeline creates no occurrence. Every trigger creates a separate occurrence, including when several due dates map to one period. Set triggeredBy if the model emits multiple trigger types; otherwise it can be inferred. A posting cashflow can omit owner; it can omit direction when a cash account is set or inferred. See Post cashflows to accounts.