GEXfocus GEXfocus API
ES EN
API page
Trading API Dashboard

Technical reference and API key management

Implementation guide for connecting GEXfocus Trading API. The API key, authentication notes and endpoint reference stay in one private workspace for development and maintenance.

API key

Current key

Validating API key...
Operational summary

Authentication, coverage and formats

Base URL, allowed tickers and authentication rules. These values apply to the endpoints below.

Base URL

https://apitrading.gexfocus.app

REST auth

Header x-api-key: YOUR_API_KEY.

WebSocket auth

key query parameter.

Tickers

qqq, spy, ndx, spx, aapl, msft, amzn, googl, meta, nvda, tsla.

PDF documentation Technical reference in PDF.

Technical reference with endpoints, payloads, limits and examples.

Live stream

NDF WebSocket

Use the stream for interfaces or processes that need granular data. Keeping the connection open is usually better than REST polling.

wss://apitrading.gexfocus.app/trading/ws/ndf?key=API_KEY&ticker=TICKER

Main stream

Publishes NDF, price, FEP, premium, thresholds, aggregate exposures and structural levels in successive messages.

ticker: qqq|spy|ndx|spx|aapl|msft|amzn|googl|meta|nvda|tsladefault: qqq
close 1008

Invalid authentication or ticker

If the key is invalid, revoked or the ticker is not covered, the server closes the connection with policy violation.

WebSocketauth
REST latest

Current snapshots and maps

All private REST endpoints use x-api-key. Strike maps share a consistent structure for heatmaps and tables.

MethodEndpointUseNotes
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

Replay, research and audit

History endpoints reconstruct sessions, feed notebooks or build reduced time series with every and summary.

MethodEndpointParametersRecommended use
GET/trading/history/ndfticker, date, limit, everyIntraday NDF, price, FEP, premium, DEX and thresholds.
GET/trading/history/ndf/sessionstickerAvailable NDF sessions.
GET/trading/history/greeks/{greek}ticker, date or start/end, limit, every, summaryHistorical GEX, Delta, Vanna or Charm snapshots.
GET/trading/history/greeks/{greek}/sessionstickerAvailable sessions by Greek.
Ranges and density

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.

Payloads

Main fields

A response can include null when a field is unavailable in that snapshot. Do not automatically interpret it as zero.

NDF stream

ticker, ts, ndf, price, fep, threshold_long, threshold_short, buy_premium, sell_premium, net_premium.

0DTE 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.

Exposures

gex_total, gex_calls, gex_puts, vanna_exposure, charm_exposure, delta_exposure.

Levels

gamma_flip, max_gamma_strike, call_wall_gamma, put_wall_gamma.

Strike maps

Envelope: ticker, ts, ts_iso, session_date, spot, net_exposure, max_strike, bars.

Strike bar

strike, calls, puts, total, gross. Useful for tables, histograms and custom heatmaps.

Examples

Base connections

Replace YOUR_API_KEY with your active key. In production, handle WS reconnects and REST timeouts.

Python WebSocket
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())
Python REST
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"])
Errors and operation

Expected codes

Handle errors explicitly, retry with backoff and separate live WS usage from historical REST usage.

CodeCommon causeAction
400Invalid ticker, Greek, date or parameter.Validate values before calling.
401Missing, invalid or revoked API key.Check x-api-key or generate a new key.
429Usage limit reached.Reduce frequency or request a volume review.
503Database or upstream temporarily unavailable.Retry with backoff.
WS 1008Invalid authentication or ticker.Validate key and ticker before reconnecting.
Best practices

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.