Files
flowsight/docs/API.md
T
asepharyana 3882c5aef0 Add comprehensive documentation for FlowSight project
- Introduced AGENT-SPECS.md detailing the specifications for seven agents including their inputs, processing steps, and outputs.
- Created API-REFERENCE.md outlining the Sectors API v2 endpoints, parameters, costs, and usage.
- Developed API.md to specify backend routes, request/response structures, and error handling.
- Established ARCHITECTURE.md to describe the project layout, conventions, scheduler, and citation pipeline.
- Added DATA-MODEL.md to define the database schema, tables, and seed strategy.
- Compiled PLAN.md to outline the project concept, problem statement, unique features, and implementation timeline.
- Created README.md as an index for documentation with links to all relevant files.
- Documented ROUTINES.md detailing the seven automated routines, their schedules, inputs, detection logic, and delivery formats.
- Introduced TECH-STACK.md to specify the technology choices and rationale for both backend and frontend components.
2026-09-14 20:35:02 +07:00

2.0 KiB

Backend API

Base /api. Demo auth: X-User-Key header (single demo key for hackathon). Errors: {error: {code, message}} with HTTP 400/404/422/502 (502 = upstream Sectors).

Flow

  • GET /api/flow/summary?date= → foreign net total, top-5 accumulation rows, rotation signal, mover of day. Each value with citations.
  • GET /api/flow/broker?ticker=&start=&end= → buyers/sellers + 5d net series.
  • GET /api/flow/foreign?ticker=&start=&end= → inflow series + reversal flag.
  • GET /api/stream → SSE (channels: agents, alerts, activity; heartbeat 15 s).

Screen

  • POST /api/screen body {where?, q?, institutional?: {broker_score_min, foreign_trend, insider_buying, volume_anomaly}, limit?} → ranked rows {symbol, name, composite, breakdown: {broker, foreign, insider, fundamental}, citations}.

Routines & briefing

  • GET /api/routines → list with enabled + last run status.
  • POST /api/routines body {type, schedule_cron?, channels[]} → created.
  • PATCH /api/routines/:id body {enabled?, schedule_cron?, channels?}.
  • GET /api/routine-runs?routine_id=&limit= → run history.
  • GET /api/briefing/today → latest briefing payload + citations.

Alerts

  • GET /api/alerts, POST /api/alerts body {name, rule, channels[]}, DELETE /api/alerts/:id, GET /api/alert-events?since=&ticker=.

Report

  • POST /api/report/:ticker query ?format=json|html|pdf|md → 7-section payload with citations[] per section. PDF rendered server-side.

Watchlist / portfolio / accuracy / chat / health

  • GET /api/watchlist, POST /api/watchlist {ticker}, DELETE /api/watchlist/:ticker.
  • GET /api/portfolio/risk → concentration[], correlation[][], beta, warnings[].
  • GET /api/accuracy → per-agent {calls, resolved, hits, hit_rate}.
  • POST /api/chat body {message, scope?: {report_id}} → cited answer (report scope restricts grounding to that report's citations).
  • GET /api/health → {last_cycle_at, credits_today, scheduler_ok, stale_flags}.