AlgoTradingAI
Docs/API Reference

API Reference

AlgoTradingAI exposes a REST API consumed by the frontend. This page documents the key endpoints, authentication, and rate limits.

Authentication

All authenticated endpoints require a JWT bearer token in the Authorization header:

Authorization: Bearer <access_token>
  • Access tokens are obtained via POST /api/auth/login or POST /api/auth/google.
  • Refresh tokens are used to obtain new access tokens via POST /api/auth/refresh.
  • Tokens are JWTs with configurable expiry.

Core Endpoints

Auth

  • POST /api/auth/register — Create account
  • POST /api/auth/login — Email/password login
  • POST /api/auth/google — Google OAuth login
  • POST /api/auth/refresh — Refresh access token
  • GET /api/auth/me — Current user profile (includes active plan)

Watchlist

  • GET /api/watchlist — List user watchlist symbols
  • POST /api/watchlist — Add symbol to watchlist
  • DELETE /api/watchlist/:symbol — Remove symbol

Advisor

  • POST /api/advisor/advise — Run full advisory pipeline (analysis + news + sentiment + AI)
  • GET /api/advisor/stream?request_id= — SSE endpoint for pipeline progress
  • POST /api/advisor/simulate — Quick backtest simulation
  • GET /api/advisor/decisions — List recent decisions
  • GET /api/advisor/decision/:id — Get decision with audit trail

Forecast

  • POST /api/forecast — Run fused forecast (multi-model)
  • GET /api/forecast/:symbol — Get latest forecast for symbol
  • GET /api/forecast/:symbol/horizons — Get all horizon forecasts

Trade Signals

  • GET /api/trades/live — Active trade signals
  • GET /api/trades/closed — Closed trade history
  • GET /api/trades/stats — Aggregate performance statistics

Paper Playground

  • POST /api/playground/orders — Place paper order
  • GET /api/playground/holdings — View paper holdings
  • GET /api/playground/history — Order history

Public SEO

  • GET /api/public/seo/stocks — Public stock summaries (rate-limited)
  • GET /api/public/seo/stocks/:slug — Stock detail by slug
  • GET /api/public/seo/options-watchlist — Options watchlist

Rate Limits

  • Public endpoints: 30 requests per 60 seconds per IP.
  • Authenticated endpoints: per-user limits based on plan tier.
  • Broker-proxied operations: subject to Zerodha KiteConnect rate limits.

Error Responses

Errors follow a consistent JSON format:

{
  "detail": "Error description",
  "code": "error_code"
}

Common error codes:

  • unauthorized — Missing or invalid token
  • forbidden — Insufficient plan tier
  • rate_limited — Too many requests
  • broker_required_for_more_symbols — Connect broker to add more symbols
  • symbol_limit_reached — Plan symbol limit exceeded

Webhooks

Webhook support for external integrations is planned for a future release. Currently, real-time updates are delivered via Server-Sent Events (SSE) on the advisor stream endpoint.