APEX: case study
A 13-week cash forecast for small businesses that keeps score on itself. Designed, built and tested by Arun Sella.

Overview
APEX reads a small business's books and predicts how much cash will be in the bank each week for the next 13 weeks, with a likely range around every number. Then it does the part most forecasting tools skip: it saves every forecast, seals it, and scores it against what actually happened.
Cash-flow forecasting tools already exist. What's rare is one that tells you how often it's been wrong. APEX is built around that: every number traces back to an invoice, a bill or a pattern in the books, every forecast can be checked later, and the results are compared against simple guesses like "cash stays where it is". It runs inside a bookkeeping app, Arun's free bookkeeping app, entirely in the browser, so a business's books never leave its computer.
- ForecastsBank cash for each of the next 13 weeks: a most-likely figure, an 80% range, and the chance of dropping below a minimum
- Built withPlain JavaScript, no server and no dependencies, inside a bookkeeping app
- Tested by66 automated tests, plus a reproducible walk-forward backtest
- BuilderArun Sella
The demo runs on books for a made-up design studio. It opens with past forecasts already rebuilt, so you can see the track record straight away.
How it works
- Rebuild the books as of a date. One function reconstructs what the books showed on any day, using only records that had been entered by then. Live forecasts and every historical test go through it, so a forecast can never peek at the future.
- Forecast each kind of cash. Open invoices land on their due date plus that customer's usual lateness, weighted by the chance invoices that overdue get paid at all. New sales and bills follow their run-rate, spread over real payment times. Regular payments like card autopay, loans and tax deposits are detected and scheduled on their real dates. Every line is labelled scheduled, estimated or what-if, and explains itself in one sentence.
- Simulate 500 versions. Each run varies which customers pay and when, and replays a real recent month of new business. The middle of the 500 is the headline forecast; the spread gives the likely range and the chance of going below a minimum. A fixed seed makes the same books always give the same answer.
- Save and seal. A saved forecast is fingerprinted with SHA-256, so any later change to it is detected and kept out of the results.
- Score against what happened. As each forecast week ends, it's compared with the actual bank cash in the books, next to the simple baselines.
What-ifs (a new hire, a one-off payment, a drop in sales, slower-paying customers) reuse the same random draws as the plain forecast, so the difference you see is the what-if, not noise.
Test results
A walk-forward backtest on the frozen demo books: a forecast every Monday from October 2025 to March 2026, 26 in all, each using only what was known that day and scored over the 13 weeks that followed (338 predictions per model). The report is byte-for-byte reproducible.
| Forecast | Average miss per week | Verdict |
|---|---|---|
| APEX headline middle of 500 simulations | $5,546 bias about $0 | 42% less miss than "cash stays flat" |
| APEX explained line the line-by-line forecast | $7,259 bias +$1,648 | 24% less miss · wins on 19 of 26 dates |
| "Cash stays flat" baseline | $9,492 | Baseline |
| "Recent trend continues" baseline: last 13 weeks' average change | $9,972 | Baseline |
| Likely ranges should contain actual cash 80% of the time | 92% 4% below, 4% above | Balanced but too wide |
| Low-cash warnings warn at a 20%+ chance of a low week | 90% of low weeks caught single line: 45% · flat: 67% | Catches more, but 2 in 3 warnings are false alarms |
All on synthetic demo books, as of November 7, 2026. These numbers show the method works; they don't yet show how APEX does on a real business.
What doesn't work yet
- No real books yet. Everything above comes from made-up data generated by a bookkeeping app' own demo code. Real businesses are messier.
- Partly tested on the data it was tuned on. Three fixes were made after looking at results on these same books. Each is a general rule, but the honest test is new data.
- Ranges are too cautious, and week-one ranges are too narrow because payroll and regular bills are treated as exact.
- The lead fades at the edges: slightly worse than "flat" in week 2, and only 6–7% better by week 13 for the explained line.
- Short history. About 15 months of books, so a "same weeks last year" comparison couldn't run.
What the tests caught
- Bank imports read
(12.50)as a deposit instead of a withdrawal, and dropped real repeated charges as duplicates. Both fixed in a bookkeeping app. - A forecast that ignored quarterly estimated-tax payments ran $4,500 too optimistic per quarter. APEX now matches them to the IRS calendar.
- The simulations replayed a one-time $150,000 owner investment and a $25,000 loan as if they could happen again, pushing the forecast $7,400 too high. Money in that isn't from customers is no longer replayed.
- A $135,000 minimum showed "stays above" on the single forecast line while the simulations gave a 77% chance of dipping below. The warning now follows the chance, not the line.
Build log
- AuditReviewed the a bookkeeping app code and data model; chose to build inside the app with no server, so books never leave the browser.
- Data fixesBank-import sign and duplicate bugs, day/month date order, entry timestamps, and frozen demo books for repeatable tests.
- Point-in-time engineRebuilds the books as of any date; proven unable to see the future.
- 13-week forecastEvery line labelled, sourced and explained; reconciles to the cent every week.
- Forecast screenChart, weekly breakdown, what-ifs and a "not counted" list inside a bookkeeping app.
- Track recordSealed saved forecasts, weekly auto-save, and scoring against actual cash.
- BacktestWalk-forward test against baselines, with volatile-week, stability and warning breakdowns.
- Ranges500-run simulation with a fixed seed; the middle of it became the headline forecast.
Next
The next step is a pilot with three to five real small businesses, with their permission: rebuild their past forecasts on their own books, then save live forecasts every week. Live results take 13 weeks to complete, so the first real track record comes about three months in. The range widths will be recalibrated on that data, not on the demo books.
Not financial advice. APEX is a prototype and a learning project. The demo uses made-up books, and nothing here is a recommendation to make any financial decision.