Skip to content
~/lucas

← Back to projects

shadow-ledger

A paper-trading engine: fictional money, real prices, and a memory of every decision to answer "what if…?".

ExperimentPrivate source code

  • TypeScript
  • Node.js 24
  • SQLite
  • Vue 3
  • Vitest

Context

No real order, no broker, no key: just public prices and fictional money. Every decision (buy, sell, do nothing) is written to a journal you can only add to. The engine can then answer “what if…?”: how does this decision compare to its alternative a few minutes, a day, a week later, and now?

The project is inspired by a rules engine with an audit journal and a survival budget, without reusing its code.

What you can do with it

  • Replay the past with strategies that never see the future, pay their fees, and are judged on a held-out period.
  • Follow a real market live with a fleet of about thirty portfolios in a single process, which can be resumed after a stop.
  • Let an agent play, including a Claude Code session on my usual plan, with no billed API.
  • Sweep a rule across 37 archived trading days, discarding unusable market days instead of counting them as zero.
  • Follow it all in a Vue dashboard that updates live.

The guarantees, checked in the code

  • A journal that can’t be rewritten: SQL triggers refuse any update or deletion, and the clock never goes backwards. You can’t backdate a decision.
  • No future: a strategy only sees two objects with private fields, and execution happens at the first strictly later price, with a dedicated test. It’s an interface guarantee, not a sandbox, and the README says so.
  • Bounded agents: two tools, caps enforced by the code and a survival budget.
  • Safe concurrent writes: immediate transactions, tested with two processes.

An honest result

I found no trading edge. This project is for measuring an idea honestly, not for making money.

The tests

264 tests across 20 files.

// For my 2026 projects, I work with AI agents (Claude Code): I frame the need, write the specification, then review and validate the code.