Main stream
Publishes NDF, price, FEP, premium, thresholds, aggregate exposures and structural levels in successive messages.
Implementation guide for connecting GEXfocus Trading API. The API key, authentication notes and endpoint reference stay in one private workspace for development and maintenance.
Base URL, allowed tickers and authentication rules. These values apply to the endpoints below.
https://apitrading.gexfocus.app
Header x-api-key: YOUR_API_KEY.
key query parameter.
qqq, spy, ndx, spx, aapl, msft, amzn, googl, meta, nvda, tsla.
Technical reference with endpoints, payloads, limits and examples.
Use the stream for interfaces or processes that need granular data. Keeping the connection open is usually better than REST polling.
Publishes NDF, price, FEP, premium, thresholds, aggregate exposures and structural levels in successive messages.
If the key is invalid, revoked or the ticker is not covered, the server closes the connection with policy violation.
All private REST endpoints use x-api-key. Strike maps share a consistent structure for heatmaps and tables.
| Method | Endpoint | Use | Notes |
|---|---|---|---|
| GET | /trading/greeks/last/{ticker} | Unified GEX, Delta, Vanna and Charm response. | Repeat greeks: ?greeks=gex&greeks=delta. |
| GET | /trading/gex/last/{ticker} | Gamma Exposure map by strike. | Includes spot, net_exposure, max_strike and bars. |
| GET | /trading/delta/last/{ticker} | Delta Exposure map by strike. | Useful to cross DEX with NDF and premium. |
| GET | /trading/vanna/last/{ticker} | Vanna Exposure map by strike. | Complementary read for volatility sensitivity. |
| GET | /trading/charm/last/{ticker} | Charm Exposure map by strike. | Intraday directional decay tracking. |
| GET | /trading/mapa_gamma/last/{ticker} | Multi-expiration matrix. | Includes expirations, strikes, matrix, vanna_matrix and charm_matrix. |
History endpoints reconstruct sessions, feed notebooks or build reduced time series with every and summary.
| Method | Endpoint | Parameters | Recommended use |
|---|---|---|---|
| GET | /trading/history/ndf | ticker, date, limit, every | Intraday NDF, price, FEP, premium, DEX and thresholds. |
| GET | /trading/history/ndf/sessions | ticker | Available NDF sessions. |
| GET | /trading/history/greeks/{greek} | ticker, date or start/end, limit, every, summary | Historical GEX, Delta, Vanna or Charm snapshots. |
| GET | /trading/history/greeks/{greek}/sessions | ticker | Available sessions by Greek. |
limit accepts up to 20000 for NDF. every samples 1 of each N records. Greek history ranges with start/end have a 5-day operational limit; use summary=true when strike bars are not needed.
A response can include null when a field is unavailable in that snapshot. Do not automatically interpret it as zero.
ticker, ts, ndf, price, fep, threshold_long, threshold_short, buy_premium, sell_premium, net_premium.
net_call_premium_0dte, net_put_premium_0dte, call_buy_premium_0dte, call_sell_premium_0dte, put_buy_premium_0dte, put_sell_premium_0dte.
gex_total, gex_calls, gex_puts, vanna_exposure, charm_exposure, delta_exposure.
gamma_flip, max_gamma_strike, call_wall_gamma, put_wall_gamma.
Envelope: ticker, ts, ts_iso, session_date, spot, net_exposure, max_strike, bars.
strike, calls, puts, total, gross. Useful for tables, histograms and custom heatmaps.
Replace YOUR_API_KEY with your active key. In production, handle WS reconnects and REST timeouts.
import asyncio
import json
import websockets
API_KEY = "YOUR_API_KEY"
TICKER = "spy"
URL = f"wss://apitrading.gexfocus.app/trading/ws/ndf?key={API_KEY}&ticker={TICKER}"
async def main():
async with websockets.connect(URL) as ws:
async for msg in ws:
data = json.loads(msg)
print(data["ticker"], data["price"], data["ndf"], data.get("gex_total"))
asyncio.run(main())
import requests
API_KEY = "YOUR_API_KEY"
BASE = "https://apitrading.gexfocus.app/trading"
resp = requests.get(
f"{BASE}/greeks/last/spx",
headers={"x-api-key": API_KEY},
timeout=10,
)
resp.raise_for_status()
data = resp.json()
print(data["ticker"], data["gex"]["net_exposure"])
Handle errors explicitly, retry with backoff and separate live WS usage from historical REST usage.
| Code | Common cause | Action |
|---|---|---|
| 400 | Invalid ticker, Greek, date or parameter. | Validate values before calling. |
| 401 | Missing, invalid or revoked API key. | Check x-api-key or generate a new key. |
| 429 | Usage limit reached. | Reduce frequency or request a volume review. |
| 503 | Database or upstream temporarily unavailable. | Retry with backoff. |
| WS 1008 | Invalid authentication or ticker. | Validate key and ticker before reconnecting. |
Keep the WebSocket open for live data. Use REST for snapshots, matrices and histories. Advanced dashboards can combine NDF with GEX, DEX, Vanna and Charm to build custom heatmaps, indicators and alerts.