API Reference
Complete REST API documentation for the Galedge backend. All endpoints return JSON.
Base URL: /api (relative to the application domain). Authenticated endpoints require a Bearer token in the Authorization header.
Authentication
/api/auth/registerCreate a new user account.
Body: { "email", "password", "full_name", "organization" }
Returns: { "access_token", "token_type": "bearer" }
/api/auth/loginAuthenticate and receive a JWT token.
Body: { "email", "password" }
Returns: { "access_token", "token_type": "bearer", "user": {...} }
Market Data
/api/quote/{symbol}Get real-time quote for a single stock.
Returns: price, change, change%, volume, market cap, name, exchange
/api/quotes?symbols=AAPL,MSFT,GOOGLGet quotes for multiple stocks at once.
Query: symbols — comma-separated list
/api/history/{symbol}Get historical OHLCV price data.
Query params: interval (1d, 1wk, 1mo), period (1mo, 3mo, 6mo, 1y, 2y, 5y)
/api/technicals/{symbol}Get technical indicators (RSI, MACD, Bollinger Bands, SMAs, EMAs).
/api/fundamentals/{symbol}?sheet=infoGet fundamental data (income statement, balance sheet, cash flow).
Query: sheet — info, income_stmt, balance_sheet, cashflow
/api/options/{symbol}?kind=callsGet options chain data.
Query: kind (calls, puts), expiry (YYYY-MM-DD)
/api/intel/{symbol}?kind=allGet intelligence data (analyst recommendations, insider trades, institutional holders, news).
Query: kind — all, recommendations, insider, institutional, mutual_fund, news
/api/search?q={query}Search for stocks by name or symbol.
Analytics
All analytics endpoints require authentication.
/api/analytics/performance/{portfolio_id}Get performance metrics: total return, CAGR, Sharpe, max drawdown, equity curve.
/api/analytics/return-decomposition/{portfolio_id}Get factor vs idiosyncratic return decomposition.
/api/analytics/holdings/{portfolio_id}Get holdings with weights, sectors, and factor exposures.
Strategies
All strategy endpoints require authentication.
/api/strategies/List all user strategies (draft and production).
/api/strategies/Create a new strategy with fund name, scheme, universe, constraints, and backtest config.
/api/strategies/{id}/promotePromote a backtested strategy to production status.
/api/strategies/{id}/demoteDemote a production strategy back to draft.
/api/strategies/{id}/rebalanceGenerate a live rebalance trade list with BUY/SELL/HOLD actions, quantities, and prices.
Optimization
/api/optimize/smartRun the portfolio optimizer. Auto-computes returns and covariance from historical prices.
Body: { "universe", "objective", "constraints": [...] }
Returns: expected return, risk, Sharpe, weight allocations
/api/optimize/efficient-frontierGenerate the efficient frontier — set of optimal portfolios at different risk levels.
Tools
/api/screenerScreen stocks by fundamental criteria.
Query: sector, pe_max, div_yield_min, sort_by
/api/heatmap?market=usGet market heatmap data (treemap layout).
Query: market — us or india
/api/compare?symbols=AAPL,MSFT&period=6moCompare stock performance over time.
/api/correlation?symbols=AAPL,MSFT&period=1yGet Pearson correlation matrix for selected stocks.
/api/predict/{symbol}Get ML prediction with signals, recommendation, and risk metrics.
Query: portfolio_value, risk_tolerance (low, medium, high)
Data & Risk Model
Data management and risk model endpoints. Require authentication.
/api/data/ingest/prices?market=india&period=2yIngest historical price data for a market.
/api/data/risk-model/build?model_name=INEC1Build the factor risk model using cross-sectional regression.
/api/data/risk-model/factors?model_name=INEC1Get factor summary (CAGR, Sharpe, drawdown for each factor).
/api/data/risk-model/correlation?model_name=INEC1Get factor correlation matrix.