Skip to content
Public template

About

Polyglot .NET Aspire + Python FastAPI playground for the Lind Capital agentic-development workshop (10 hands-on tasks, 3 intentional defects).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

stocks-workshop

A small but real .NET Aspire solution for the Lind Capital agentic-development workshop. A C# minimal-API fronts a Python FastAPI worker — the same C#/Python split Lind runs in production, without being Lind's actual stack. It is a toy: the data is yfinance, there is no trading logic, and there is no real money.

The repo is the playground for 10 hands-on tasks (see _instructor/ if you are running the workshop). A few intentional defects ship with it so some of those tasks have real bait waiting.

Layout

stocks-workshop/
├── .env.example         # copy to .env per worktree; offsets ports
├── stocks.AppHost/      # Aspire orchestrator (wires Api + Worker, .env-driven ports)
├── stocks.Api/          # C# minimal-API surface
├── stocks.Worker/       # Python FastAPI service (market data, cache, analyzers)
└── stocks.Tests/        # xUnit for the C# side

Prerequisites

Tool Version used to build this Notes
.NET SDK 10.0.300 Aspire ships as NuGet packages (v13.4)
uv 0.11+ manages the Python 3.12 interpreter
Python 3.12 (via uv) pinned in .python-version

No global Python install is required — uv sync fetches a matching 3.12.

Quick start

# 1. C# side
dotnet build stocks.slnx
dotnet test  stocks.slnx          # green

# 2. Python worker
cd stocks.Worker
uv sync
uv run pytest                     # 5 reds on purpose: Task 3 (4) + Task 6 (1)
cd ..

# 3. Run everything under Aspire
dotnet dev-certs https --trust   # one-time; the dashboard + endpoints use HTTPS
dotnet run --project stocks.AppHost

The AppHost prints a dashboard URL with a login token. Resources (Api + worker) are served over HTTPS — e.g. https://localhost:5100/health for the worker. The worker is a uv project, so Aspire launches it with AddUvicornApp(...).WithUv() (uv sync + uvicorn); the plain AddPythonApp path needs pip in the venv, which uv sync does not create.

Prefer HTTP / skipping the dev-cert? Run with ASPIRE_ALLOW_UNSECURED_TRANSPORT=true and the http launch profile.

Want to run fully offline (no Yahoo, no OpenAI)? Set USE_MOCK_DATA=true in .env for deterministic synthetic candles and a canned summary.

Running several worktrees at once? WORKTREE_OFFSET shifts the Api/worker proxy ports, but the Aspire dashboard/OTLP ports live in stocks.AppHost/Properties/launchSettings.json and are static — bump those per worktree too (or launch with distinct ASPNETCORE_URLS) so two dashboards don't fight over port 15000.

Endpoints

The Api proxies these to the worker:

Method Route Returns
GET /health { "status": "ok" }
GET /quote/{symbol} latest price
GET /history/{symbol}?period=1mo OHLCV candles
GET /recommend/{symbol} buy/hold/sell + free-text rationale

Parallel work via worktrees

git worktree add ../stocks-workshop-task-04 -b you/task-04
cd ../stocks-workshop-task-04
cp .env.example .env
# set WORKTREE_OFFSET=40 (task number * 10) so ports/caches don't collide

About

Polyglot .NET Aspire + Python FastAPI playground for the Lind Capital agentic-development workshop (10 hands-on tasks, 3 intentional defects).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages