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.
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
| 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.
# 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.AppHostThe 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_OFFSETshifts the Api/worker proxy ports, but the Aspire dashboard/OTLP ports live instocks.AppHost/Properties/launchSettings.jsonand are static — bump those per worktree too (or launch with distinctASPNETCORE_URLS) so two dashboards don't fight over port 15000.
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 |
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