Code Examples¶
Copy-paste examples for every public endpoint. Save your key once as an environment
variable named GAMMAEDGE_API_KEY (see
Save your key
for Windows, Mac and Linux), and every example below just works.
‼️ Keep your key out of your code
Notice the examples never write the key itself — they always read it from the
environment. Do the same in your projects: never paste your sk_ key into source
files, notebooks, or anything you commit or share.
Python examples use the standard library only (urllib), so there's nothing to install.
Note
Sample response values below are illustrative — the field names, nesting, and types
match the live API, but the numbers are examples. Optional fields that are absent for a
given request are returned as null.
Volume-delta — latest slice¶
On Windows
These examples are written for Mac and Linux. In Windows Command Prompt, put
the whole command on one line (drop the \ line break) and write the key as
%GAMMAEDGE_API_KEY% instead of $GAMMAEDGE_API_KEY. See
Make your first request.
/latest returns the most recent completed 5-minute slice as the only entry in slices.
spot_last_updated is the time of that slice.
Sample response
{
"status": "completed",
"ticker": "AAPL",
"session_date": "2026-07-21",
"session_status": "live",
"generated_at": "2026-07-21T09:45:10-04:00",
"data_status": "complete",
"spot_price": 224.18,
"spot_last_updated": "2026-07-21T09:40:00-04:00",
"spot_basis": null,
"spot_basis_time": null,
"expiry_date": "2026-07-24",
"total_oi": 183420,
"slices": [
{
"snapshot_timestamp": "2026-07-21T09:40:00-04:00",
"strikes": [
{
"strike": 225.0,
"call_volume": 420,
"put_volume": 315
}
],
"volume_quality": "nonzero"
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Volume-delta — full session¶
The full-session payload lists every completed slice in slices, ordered by snapshot_timestamp.
Sample response
{
"status": "completed",
"ticker": "AAPL",
"session_date": "2026-07-21",
"session_status": "live",
"generated_at": "2026-07-21T09:45:10-04:00",
"data_status": "complete",
"spot_price": 224.18,
"spot_last_updated": "2026-07-21T09:40:00-04:00",
"spot_basis": null,
"spot_basis_time": null,
"expiry_date": "2026-07-24",
"total_oi": 183420,
"slices": [
{
"snapshot_timestamp": "2026-07-21T09:30:00-04:00",
"strikes": [
{
"strike": 225.0,
"call_volume": 510,
"put_volume": 440
}
],
"volume_quality": "nonzero"
},
{
"snapshot_timestamp": "2026-07-21T09:35:00-04:00",
"strikes": [
{
"strike": 225.0,
"call_volume": 390,
"put_volume": 280
}
],
"volume_quality": "nonzero"
},
{
"snapshot_timestamp": "2026-07-21T09:40:00-04:00",
"strikes": [
{
"strike": 225.0,
"call_volume": 420,
"put_volume": 315
}
],
"volume_quality": "nonzero"
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Volume-delta — single slice¶
HH:MM Eastern Time or an ISO 8601 timestamp with a UTC offset, within 09:25–16:05 ET.
Times between slices resolve to the nearest 5-minute slice (exact ties go to the earlier
one), a time up to 5 minutes outside the session gets the 09:30 slice or the last slice
(15:55; 12:55 on early-close days), and
snapshot_timestamp shows the slice returned. A slice that isn't stored
yet returns 404 (7000001) naming the latest available slice. Same shape as /latest:
the requested slice is the only entry in slices, and spot_last_updated is still the
session's most recent slice.
Volume analytics¶
Sample response
{
"status": "completed",
"ticker": "AAPL",
"session_date": "2026-07-21",
"session_status": "live",
"data_status": "complete",
"data": {
"total_oi": 183420,
"spot_price": 224.18,
"spot_basis": null,
"spot_basis_time": null,
"expiries": [
{
"expiry_date": "2026-07-24",
"strikes": [
{
"strike": 225.0,
"call_volume": 12450,
"put_volume": 9380
}
]
}
]
},
"error_message": null,
"error_code": null,
"metadata": null
}
Centroid analytics¶
Sample response
{
"status": "completed",
"ticker": "AAPL",
"session_date": "2026-07-21",
"session_status": "live",
"generated_at": "2026-07-21T09:45:10-04:00",
"data_status": "complete",
"expiry_date": "2026-07-24",
"spot_last_updated": "2026-07-21T09:40:00-04:00",
"slice_count": 3,
"call_linfit_base_price": 225.99,
"put_linfit_base_price": 222.01,
"slices": [
{
"snapshot_timestamp": "2026-07-21T09:30:00-04:00",
"spot_price": 224.02,
"volume_quality": "nonzero",
"call_centroid_strike": 226.0,
"call_centroid_volume": 6120.0,
"put_centroid_strike": 222.0,
"put_centroid_volume": 5230.0,
"strike_calls_slope": null,
"strike_puts_slope": null,
"strike_calls_roc": null,
"strike_puts_roc": null,
"calls_vol_slope": null,
"puts_vol_slope": null,
"calls_vol_roc": null,
"puts_vol_roc": null,
"call_linfit_eod_price": 226.0,
"put_linfit_eod_price": 222.0,
"regime": "n/a"
},
{
"snapshot_timestamp": "2026-07-21T09:35:00-04:00",
"spot_price": 224.1,
"volume_quality": "nonzero",
"call_centroid_strike": 226.02,
"call_centroid_volume": 12380.01,
"put_centroid_strike": 221.98,
"put_centroid_volume": 10870.01,
"strike_calls_slope": 0.004,
"strike_puts_slope": -0.004,
"strike_calls_roc": null,
"strike_puts_roc": null,
"calls_vol_slope": 1252.002,
"puts_vol_slope": 1128.002,
"calls_vol_roc": null,
"puts_vol_roc": null,
"call_linfit_eod_price": 227.54,
"put_linfit_eod_price": 220.46,
"regime": "flat"
},
{
"snapshot_timestamp": "2026-07-21T09:40:00-04:00",
"spot_price": 224.18,
"volume_quality": "nonzero",
"call_centroid_strike": 226.08,
"call_centroid_volume": 18420.03,
"put_centroid_strike": 221.92,
"put_centroid_volume": 16110.03,
"strike_calls_slope": 0.008,
"strike_puts_slope": -0.008,
"strike_calls_roc": 0.004,
"strike_puts_roc": -0.004,
"calls_vol_slope": 1230.0034,
"puts_vol_slope": 1088.0034,
"calls_vol_roc": -21.9986,
"puts_vol_roc": -39.9986,
"call_linfit_eod_price": 229.07,
"put_linfit_eod_price": 218.93,
"regime": "flat"
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Spec put/call analytics¶
Each slice carries the absolute call percentiles c10–c50 and put percentiles p10–p50.
Sample response
{
"status": "completed",
"ticker": "AAPL",
"session_date": "2026-07-21",
"session_status": "live",
"generated_at": "2026-07-21T09:45:10-04:00",
"data_status": "complete",
"expiry_date": "2026-07-24",
"spot_last_updated": "2026-07-21T09:40:00-04:00",
"slice_count": 3,
"slices": [
{
"snapshot_timestamp": "2026-07-21T09:30:00-04:00",
"spot_price": 224.02,
"volume_quality": "nonzero",
"c10": 226.0,
"c20": 226.0,
"c30": 226.0,
"c40": 226.0,
"c50": 226.0,
"p10": 222.0,
"p20": 222.0,
"p30": 222.0,
"p40": 222.0,
"p50": 222.0
},
{
"snapshot_timestamp": "2026-07-21T09:35:00-04:00",
"spot_price": 224.1,
"volume_quality": "nonzero",
"c10": 226.0,
"c20": 226.0,
"c30": 226.01,
"c40": 226.01,
"c50": 226.01,
"p10": 222.0,
"p20": 222.0,
"p30": 221.99,
"p40": 221.99,
"p50": 221.99
},
{
"snapshot_timestamp": "2026-07-21T09:40:00-04:00",
"spot_price": 224.18,
"volume_quality": "nonzero",
"c10": 226.0,
"c20": 226.01,
"c30": 226.01,
"c40": 226.02,
"c50": 226.02,
"p10": 222.0,
"p20": 221.99,
"p30": 221.99,
"p40": 221.98,
"p50": 221.98
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Positioning for one expiry¶
One expiry per call; the response is every strike of that expiry, with the columns of the web app strike table:
call_oi, put_oi, net_oi (call_oi minus put_oi), net_delta, net_gamma, net_vanna and net_charm.
All three open interest columns are GE open interest and can be negative.
Request any expiry listed in the served options chain, including dates outside the upper quartile.
An unlisted date returns HTTP 400 with error code 7000000, target expiry, and the listed dates.
Send one expiry per call; two in one call return 400.
Sample response
{
"status": "completed",
"ticker": "SPY",
"expiry": "2026-07-21",
"dte": 0,
"generated_at": "2026-07-21T14:35:00-04:00",
"data_state": "interim",
"eod_pipeline_completed_at": null,
"spot": 637.42,
"spot_last_updated": "2026-07-21T14:35:00-04:00",
"spot_basis": "feed",
"spot_basis_time": "2026-07-21T14:35:00-04:00",
"session_date": "2026-07-21",
"session_status": "live",
"oi_date": "2026-07-20",
"oi_loaded_at": "2026-07-21T06:31:02-04:00",
"short_interest_adjusted": true,
"strikes": [
{
"strike": 637.0,
"call_oi": 4120,
"put_oi": 12874,
"net_oi": -8754,
"net_delta": -702318.5,
"net_gamma": -221904.1,
"net_vanna": -12406.3,
"net_charm": 30117.9
},
{
"strike": 638.0,
"call_oi": 5343,
"put_oi": 10510,
"net_oi": -5167,
"net_delta": -555484.2,
"net_gamma": -144467.8,
"net_vanna": -9832.7,
"net_charm": 21650.4
},
{
"strike": 639.0,
"call_oi": 9876,
"put_oi": -312,
"net_oi": 10188,
"net_delta": 402117.6,
"net_gamma": 287530.2,
"net_vanna": 8811.4,
"net_charm": -17402.6
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Expiries¶
Returns every expiry in the served chain, nearest first.
expiry_type is "Monthly" or "Quarterly"; it is omitted on other expiries (e.g. weekly).
Sample response
{
"status": "completed",
"ticker": "AAPL",
"generated_at": "2026-07-21T14:35:00-04:00",
"session_date": "2026-07-21",
"session_status": "live",
"expiries": [
{
"expiry_date": "2026-07-24",
"dte": 3
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Expiry quartiles¶
Every listed expiry is ranked by its open interest. quartile 1 is the upper quartile (UQ), and uq_coverage_pct is the share of the total those expiries hold. Pass ?quartile_cut=0.1 (0.05 to 0.5) to change the cut.
/v1/positioning/{ticker} accepts any expiry listed in the served options chain, regardless of its quartile.
Sample response
{
"status": "completed",
"ticker": "QQQ",
"generated_at": "2026-07-21T14:35:00-04:00",
"session_date": "2026-07-21",
"session_status": "live",
"run_time": "2026-07-21T14:35:00-04:00",
"oi_basis": "net",
"quartile_cut": 0.25,
"total_oi": 1000000,
"uq_coverage_pct": 55.0,
"expiries": [
{
"expiry_date": "2026-08-21",
"dte": 31,
"oi": 300000,
"oi_pct": 30.0,
"quartile": 1,
"rank": 0.0
},
{
"expiry_date": "2026-09-18",
"dte": 59,
"oi": 250000,
"oi_pct": 25.0,
"quartile": 1,
"rank": 0.125
},
{
"expiry_date": "2026-12-18",
"dte": 150,
"oi": 150000,
"oi_pct": 15.0,
"quartile": 2,
"rank": 0.25
},
{
"expiry_date": "2026-07-21",
"dte": 0,
"oi": 90000,
"oi_pct": 9.0,
"quartile": 2,
"rank": 0.375
},
{
"expiry_date": "2026-07-31",
"dte": 10,
"oi": 80000,
"oi_pct": 8.0,
"quartile": 3,
"rank": 0.5
},
{
"expiry_date": "2026-07-24",
"dte": 3,
"oi": 60000,
"oi_pct": 6.0,
"quartile": 3,
"rank": 0.625
},
{
"expiry_date": "2026-07-22",
"dte": 1,
"oi": 40000,
"oi_pct": 4.0,
"quartile": 4,
"rank": 0.75
},
{
"expiry_date": "2026-07-23",
"dte": 2,
"oi": 30000,
"oi_pct": 3.0,
"quartile": 4,
"rank": 0.875
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Usage¶
Defaults to the last 7 days; pass ?start=YYYY-MM-DD&end=YYYY-MM-DD to change the window.
Sample response
{
"start_date": "2026-07-15",
"end_date": "2026-07-21",
"keys": [
{
"key_id": "abc123def456",
"key_name": "production-key",
"tier": "self_serve",
"tenant_id": "discord-123456789012345678",
"tenant_name": "example-trader",
"total_used": 3500,
"quota_remaining": 175500,
"daily": [
{
"date": "2026-07-15",
"used": 710,
"remaining": 178290
},
{
"date": "2026-07-16",
"used": 655,
"remaining": 177635
},
{
"date": "2026-07-17",
"used": 802,
"remaining": 176833
},
{
"date": "2026-07-18",
"used": 0,
"remaining": 176833
},
{
"date": "2026-07-19",
"used": 0,
"remaining": 176833
},
{
"date": "2026-07-20",
"used": 693,
"remaining": 176140
},
{
"date": "2026-07-21",
"used": 640,
"remaining": 175500
}
]
}
]
}
tenant_id, key_name and key_id are labels for your account and your key. None of them is
part of your API key: only the sk_... value goes in X-API-Key.
Delta Balance¶
No DTE parameters returns the next expiry; min_dte equal to max_dte returns that one expiry; a range (below,
1 to 5 days) returns net delta positioning across the expiries in the window, with expiry_date_from /
expiry_date_to and their dte_from / dte_to in place of expiry_date and dte.
Sample response
{
"status": "completed",
"ticker": "QQQ",
"generated_at": "2026-07-21T14:35:00-04:00",
"data_state": "interim",
"eod_pipeline_completed_at": null,
"eval_price": 562.4,
"eval_price_is_default": true,
"spot_last_updated": "2026-07-21T14:35:00-04:00",
"spot_basis": "feed",
"spot_basis_time": "2026-07-21T14:35:00-04:00",
"session_date": "2026-07-21",
"session_status": "live",
"expiry_date": null,
"dte": null,
"expiry_date_from": "2026-07-22",
"expiry_date_to": "2026-07-25",
"dte_from": 1,
"dte_to": 4,
"delta_balance": 0.38,
"lhp_balance": -0.31,
"rhp_balance": 0.69,
"error_message": null,
"error_code": null,
"metadata": null
}
Delta Balance forward¶
The next listed expiries, nearest first, all at the current spot (count is optional).
Sample response
{
"status": "completed",
"ticker": "SPXP",
"generated_at": "2026-07-21T14:35:00-04:00",
"data_state": "interim",
"eod_pipeline_completed_at": null,
"eval_price": 6388.25,
"eval_price_is_default": true,
"spot_last_updated": "2026-07-21T14:35:00-04:00",
"spot_basis": "feed",
"spot_basis_time": "2026-07-21T14:35:00-04:00",
"session_date": "2026-07-21",
"session_status": "live",
"count": 5,
"expiries": [
{
"expiry_date": "2026-07-21",
"dte": 0,
"delta_balance": 0.38,
"lhp_balance": -0.31,
"rhp_balance": 0.69
},
{
"expiry_date": "2026-07-22",
"dte": 1,
"delta_balance": 0.28,
"lhp_balance": -0.36,
"rhp_balance": 0.64
},
{
"expiry_date": "2026-07-23",
"dte": 2,
"delta_balance": 0.16,
"lhp_balance": -0.42,
"rhp_balance": 0.58
},
{
"expiry_date": "2026-07-24",
"dte": 3,
"delta_balance": 0.06,
"lhp_balance": -0.47,
"rhp_balance": 0.53
},
{
"expiry_date": "2026-07-27",
"dte": 6,
"delta_balance": -0.1,
"lhp_balance": -0.55,
"rhp_balance": 0.45
}
],
"error_message": null,
"error_code": null,
"metadata": null
}
Handling errors¶
Branch on the numeric error_code, not the message text:
import json
import os
import urllib.error
import urllib.request
def get(path: str) -> dict:
req = urllib.request.Request(
f"https://api.gammaedge.us{path}",
headers={"X-API-Key": os.environ["GAMMAEDGE_API_KEY"]},
)
try:
with urllib.request.urlopen(req) as resp:
return json.load(resp)
except urllib.error.HTTPError as exc:
body = json.load(exc)
raise RuntimeError(f"{body['error_code']}: {body['error_message']}") from exc
A failed request returns the matching HTTP status and this body:
{
"status": "failed",
"command_name": "vold",
"error_code": "7000000",
"error_message": "That ticker symbol doesn't look valid. Please check it and try again.",
"target": "ticker"
}
See Error Messages for the full catalog.