# API Reference

Base URL: `http://localhost:8000` — interactive docs at `/docs` (Swagger UI).

## Health
| Method | Path | Description |
|---|---|---|
| GET | `/health` | `{status, mode: "paper-trading-only"}` |

## Auth
| Method | Path | Description |
|---|---|---|
| POST | `/api/auth/register` | Body `{email, password}` → user |
| POST | `/api/auth/login` | Form `username`/`password` → `{access_token}` |
| GET | `/api/auth/me` | Bearer token → current user |

## Dashboard
| GET | `/api/dashboard/summary` | Portfolio stats, last scan, top approved signals |

## Scanner
| POST | `/api/scanner/run` | Run the full agent pipeline; creates signals |
| GET | `/api/scanner/results` | Latest scan run (ranked universe rows) |

## Signals
| GET | `/api/signals?status=approved\|rejected&limit=50` | List signals |
| GET | `/api/signals/{id}` | Full signal detail (scores, rationale, contract, indicators) |

## Paper Trades
| GET | `/api/paper-trades` | All trades |
| POST | `/api/paper-trades` | Body `{signal_id, quantity?}` — approved signals only |
| POST | `/api/paper-trades/mark` | Mark-to-market; auto-close on stop/target |
| POST | `/api/paper-trades/{id}/close` | Manual close at market |

## Risk
| GET | `/api/risk/rules` | Configured thresholds |
| GET | `/api/risk/summary` | Portfolio + risk utilization |

## Reports
| GET | `/api/reports/daily` | Last 30 daily reports |
| POST | `/api/reports/generate` | Generate/refresh today's report |
