Vit Busek
← Work

August 2026

Trader

A trading terminal with imaginary money: prices stream in twice a second, and an assistant that can read your portfolio and place the trades for you.

The Trader terminal after a five-share AAPL buy: a ten-ticker watchlist on the left, an AAPL price chart above the open position and a session P&L chart in the centre, and the assistant's prompt suggestions on the right.
Role
Solo build — frontend, backend, infrastructure
Stack
Next.js, FastAPI, Postgres, SSE, OpenRouter, Docker, Vercel

What it brings

Technical design

SSE /api/market/streamlitellm (container build)

Client

  • Next.js 15 (static export)

  • Zustand

  • lightweight-charts

Server

  • FastAPI

    One serverless function, api/index.py.

  • app/market

    Deterministic prices, two ticks a second.

  • app/llm

Data

  • Postgres

    Driven by asyncpg.

External

  • OpenRouter

    Container build only.

GET /api/*

asyncpg

  1. One FastAPI app, two deployments. The container build simulates prices with numpy and answers through a real model; the Vercel function computes them in closed form and ships LLM_MOCK=true. Both talk to the same Postgres, and the routes are identical, so the frontend never learns which build it reached.
  2. SSE, not WebSockets. Prices only ever flow one way. STREAM_MAX_SECONDS is 55, which keeps a stream inside Vercel's sixty-second ceiling for a function.
  3. The frontend is a static export on the CDN. vercel.json rewrites only /api/* into Python, so no page render ever passes through the function.

The demo runs the serverless build with no database attached, so the portfolio starts at $10,000 and resets whenever the instance is recycled.