API reference

VECTOR's frontend talks to a FastAPI backend over a REST API. This page documents that surface for transparency.

Internal API

This API exists to serve the VECTOR web app. It is authentication-gated, scoped to your user, and not a public, versioned contract — endpoints may change without notice. There is no public API key programme.

Authentication

Every request carries a Supabase JWT as Authorization: Bearer <token> (or, in local development, a backend-signed cookie). The backend verifies it and resolves your user_id; unauthenticated requests are rejected. See Security.

Auth

POST/api/auth/login
Local-dev login; sets the session cookie.
POST/api/auth/logout
Clears the session.
GET/api/auth/me
The current identity.

Sessions & strategies

POST/api/analysis/upload
Upload one or more CSVs; creates a session.
GET/api/analysis/sessions
List your sessions.
GET/api/analysis/session/{sid}
Session detail (strategies, parameters, per-strategy sizing).
PATCH/api/analysis/session/{sid}
Update parameters (capital, mode, daily budget, compounding).
PUT/api/analysis/session/{sid}/strategies
Update weights / visibility / per-strategy sizing (mode, SL, Cap %, min/max).
PATCH/api/analysis/session/{sid}/strategies/{name}/rename
Rename a strategy in the session.
DELETE/api/analysis/session/{sid}/strategies/{name}
Remove a strategy from the session.
DELETE/api/analysis/session/{sid}
Delete the session.

Analytics

GET/api/analysis/session/{sid}/equity
Aggregated equity curve (with sizing flags/warnings when dynamic sizing is active).
GET/api/analysis/session/{sid}/metrics
Performance & risk metrics.
GET/api/analysis/session/{sid}/rolling
Moving-window return distributions (1w→1y) of the current portfolio.
GET/api/analysis/session/{sid}/allocation
Per-trade allocation rows of the sized legs (empty when all strategies are fixed).
GET/api/analysis/session/{sid}/monthly
Monthly P/L grid.
POST/api/analysis/session/{sid}/montecarlo
Run a Monte Carlo simulation (with dynamic sizing active it re-runs the allocation per path; block_size weekly/monthly/quarterly, block bootstrap only).
POST/api/analysis/session/{sid}/equity-control
Start an Equity Control diagnosis — returns a job_id.
GET/api/analysis/session/{sid}/equity-control/{job_id}
Poll an Equity Control job (running / done / error).
POST/api/analysis/session/{sid}/correlation
Correlation matrix.

Library, variants & risk sizing

GET/api/analysis/portfolio/saved
Saved portfolios (also POST / DELETE).
GET/api/analysis/strategies/saved
Saved strategies (also POST / DELETE).
GET/api/analysis/variants
List / freeze / restore variants.
POST/api/analysis/proporzionatore/run
Start a Risk Sizing run — returns a job_id.
POST/api/analysis/proporzionatore/montecarlo
Start a Risk Sizing Monte Carlo — returns a job_id.
GET/api/analysis/proporzionatore/jobs/{job_id}
Poll a Risk Sizing job (running / done / error).

Naming

In the codebase and API, Risk Sizing is still called proporzionatore — the user-facing rename didn't change the internal route names.

Simulations run as background jobs

Both Risk Sizing simulations (the run and its Monte Carlo) execute on the server, decoupled from the HTTP request: the POST returns a job_id immediately and the client polls the jobs endpoint. The run keeps going while your phone screen is off or the tab is in the background, and the recipe is persisted so a mid-run backend restart re-runs it transparently. The session Monte Carlo simulation works the same way.