Inspiration

Your bank tells you what already happened. It never tells you what happens next. We kept asking a simple question before every purchase: "What does this do to my goals?" Nothing we used could answer it.

What it does

TwinBank builds a financial twin from your transaction history, then lets you test decisions on it before you make them.

Meet Alex, a college student saving for summer housing. Alex wants an $800 laptop. TwinBank simulates Alex's next few months twice, with and without the laptop, and puts the two futures side by side. For each future it estimates the chance of a low balance:

$$\hat{p} = \frac{1}{N}\sum_{i=1}^{N} \mathbf{1}\left[\min_t B_i(t) < \text{floor}\right], \qquad N = 1000$$

There's no "you can afford it" verdict. We show the tradeoffs, suggest alternatives that keep every limit Alex set, and let Alex decide.

How we built it

  • Python and FastAPI on the backend, with Next.js on the front.
  • Capital One Nessie supplies the transactions. We seeded Alex into the live sandbox and read him back to check the twin still came out right.
  • Databricks runs the twin build as a serverless job through an Asset Bundle, and MLflow can log every build. Both are switched off by default.
  • Gemini reads plain-English goals into draft cards. Code checks every field it returns, and anything that doesn't check out becomes a question instead of a guess.

Challenges we ran into

  • Keeping AI away from the money. The model only reads text. Balances, risk and every number on screen come from deterministic code.
  • Nessie's quirks. An empty sandbox, a documented host that refuses connections, and amounts stored in whole dollars.
  • Gemini's 10-second minimum. It rejected our 6-second timeout, so we kept our own limit and sent the deadline separately.
  • Three of us shipping at once. We froze the shared data contracts so nobody broke anybody else.

Accomplishments that we're proud of

  • The whole story works end to end: Alex, the twin, the laptop, the simulation, then the alternatives.
  • A fresh clone runs the full demo with no keys and no network.
  • Over a thousand automated tests, and a model that can never invent a number.

What we learned

Build the full flow on mocks first, then plug in the real services. Use AI for language and code for math. And show people the tradeoffs rather than telling them what to do.

What's next for TwinBank

  • Run the Databricks job against a live workspace.
  • Make Nessie the default data source.
  • Add bigger "what if" scenarios: a lost job, a new lease, a goal that has to move.

Built With

  • capital-one-nessie
  • databricks
  • fastapi
  • google-gemini
  • mlflow
  • nextjs
  • pydantic
  • pytest
  • python
  • react
  • tailwindcss
  • typescript
  • uv
Share this project:

Updates

Submission history