Skip to content

API Reference

The QGTM.AI platform exposes a REST API via FastAPI. When the server is running, interactive documentation is available at:

Base URL

Environment URL
Local dev http://localhost:8000
Production https://api.qgtm.ai

All endpoints are prefixed with /api/v1.

Core Endpoints

Universe

Method Path Description
GET /api/v1/universe List all 42 commodity ETFs in the trading universe
GET /api/v1/universe/{symbol} Get details for a single instrument

Market Data

Method Path Description
GET /api/v1/market-data/{symbol} Latest price data for an instrument
GET /api/v1/bars/{symbol} Historical OHLCV bars

Portfolio

Method Path Description
GET /api/v1/portfolio Current portfolio positions and P&L
GET /api/v1/portfolio/history Historical portfolio value

Signals

Method Path Description
GET /api/v1/signals Latest trading signals from all strategies
GET /api/v1/signals/top Top N signals ranked by conviction

Orders

Method Path Description
GET /api/v1/orders List recent orders
POST /api/v1/orders Submit a new order

Options

Method Path Description
GET /api/v1/options/chain/{symbol} Options chain for a symbol
GET /api/v1/options/greeks/{symbol} Greeks for option positions

WebSocket

Protocol Path Description
WS /ws Real-time price and signal streaming

Authentication

API requests require an API key passed in the Authorization header:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.qgtm.ai/api/v1/universe

Subscriber-tier endpoints require an active subscription verified via Stripe.

Rate Limits

Tier Requests/min
Free 60
Basic 300
Pro 1000
Institutional Unlimited

Error Format

All errors follow a consistent JSON format:

{
  "detail": "Instrument not found: XYZ",
  "status_code": 404
}

Python Client Example

import httpx

client = httpx.Client(
    base_url="http://localhost:8000",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)

universe = client.get("/api/v1/universe").json()
print(f"{universe['count']} instruments loaded")