fire-planner/fire_planner
Viktor Barzin 2fc92c12f5
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled
engine+api: plumb life events into the simulator
Until now life events were stored but ignored by the engine — pure
metadata. Now they actually move portfolios.

Engine:
- simulator.simulate() takes optional cashflow_adjustments: a (n_years,)
  real-GBP array applied each year *after* savings + return but
  *before* withdrawal. Positive = inflow, negative = outflow.
- New fire_planner/life_events.py with EventInput dataclass +
  events_to_cashflow_array(events, horizon). Handles ranged deltas,
  one-time amounts, disabled events, year clipping past horizon,
  negative year_start (clipped to 0), and summing multiple events.

API:
- /simulate accepts optional life_events list. Server converts each
  to EventInput, builds cashflow_adjustments, passes to simulate().
- Frontend Run-now on scenario detail now fetches the scenario's
  life events and includes them in the request — projections finally
  reflect "retire at 50, kid born at y3, inheritance at y22".

Tests: 11 events helper + 4 end-to-end engine + 1 API integration =
16 new tests. 188 total (was 172). mypy strict + ruff clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 22:30:33 +00:00
..
api engine+api: plumb life events into the simulator 2026-05-09 22:30:33 +00:00
ingest ingest: switch wealthfolio to pg-sync mirror reads 2026-05-09 21:33:48 +00:00
reporters Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
returns Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
strategies Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
tax Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
__init__.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
__main__.py ingest: switch wealthfolio to pg-sync mirror reads 2026-05-09 21:33:48 +00:00
app.py deploy: combined Dockerfile — FastAPI serves the SPA in prod 2026-05-09 22:25:52 +00:00
db.py schema: add life_event, retirement_goal; extend scenario with kind/parent 2026-05-09 21:36:58 +00:00
fx.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
glide_path.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
life_events.py engine+api: plumb life events into the simulator 2026-05-09 22:30:33 +00:00
scenarios.py Initial extraction from monorepo 2026-05-07 17:06:19 +00:00
simulator.py engine+api: plumb life events into the simulator 2026-05-09 22:30:33 +00:00