Documentation
API reference
Overview
api.py is a read-only FastAPI layer: one generic route per dataset, driven by a declarative RELATIONS table, plus three hand-built routes for the core congressional-trades scope. Interactive Swagger docs are auto-generated at /docs on any running instance.
Base URL: https://api.quantgress.dhruvmulajkar.me — requires an API key on every request. Not built: CORS.
Authentication
Every route (except interactive docs) requires an X-API-Key header. Requests with a missing or invalid key get 401. Keys are issued by request — see API access.
curl -H "X-API-Key: qg_live_..." "https://api.quantgress.dhruvmulajkar.me/trades?tkr=NVDA&limit=1"
Rate limits
500 requests/day per API key. Exceeding the limit returns 429.
Endpoints
GET /
Dataset names and row counts.
GET /trades
Unified trades view, both chambers. Query: tkr (exact, case-insensitive), last_name (substring, case-insensitive), chamber (S or H, exact), limit, offset.
GET /politician/{name}
One member's summary + trade listing, matched on last_name by substring.
GET /ticker/{symbol}
All activity for one stock symbol, exact match, case-insensitive.
GET /lobbying · /contracts · /insiders · /13f-positions · /13f-changes · /13f-top-holders · /patents · /donors · /pageviews · /exec-comp · /trump-trades · /senate-assets · /senate-liabilities
Generic filtered listing, one route per dataset via the same RELATIONS-driven handler. Filter columns differ per dataset (a ticker column filters exact case-insensitive, a name column filters by substring, a code/year/CIK column filters exact) — see RELATIONS in api.py for the column list on a given dataset.
Every listing route also accepts limit (default 100, max 1000) and offset.
Example
curl -H "X-API-Key: qg_live_..." "https://api.quantgress.dhruvmulajkar.me/trades?tkr=NVDA&limit=1"
{
"trades": [
{
"chamber": "S",
"last_name": "Doe",
"tkr": "NVDA",
"tkr_recovered": false,
"txn_date": "2026-05-12",
"filed_date": "2026-06-02",
"amount_low": 1001,
"amount_high": 15000
}
],
"limit": 1,
"offset": 0
}
Python example
Fetch the last 50 Senate trades with requests:
import requests
BASE_URL = "https://api.quantgress.dhruvmulajkar.me"
API_KEY = "qg_live_..."
resp = requests.get(
f"{BASE_URL}/trades",
headers={"X-API-Key": API_KEY},
params={"chamber": "S", "limit": 50},
)
if resp.status_code == 401:
raise SystemExit("401 Unauthorized: missing or invalid API key.")
if resp.status_code == 429:
raise SystemExit("429 Rate limited: 500 requests/day per key exceeded.")
resp.raise_for_status()
for t in resp.json()["trades"]:
print(f"{t['txn_date']} | filed {t['filed_date']} | "
f"{t['last_name']:<15} | {t['tkr']:<6} | "
f"${t['amount_low']}-${t['amount_high']}")