Standalone Gamma Exposure CLI for FnO option chain JSON
Project description
gamma-wall
Standalone Python tool for calculating Gamma Exposure (GEX) from option-chain snapshots.
This tool does not use Streamlit, React, or any frontend. The package core does not require the Nubra SDK; users can pass either a Nubra SDK option_chain() result object or raw option-chain data.
Install
pip install gamma-wall
For URL loading and prettier tables:
pip install "gamma-wall[all]"
Run
Local JSON:
python gamma_wall.py --symbol NIFTY --expiry 2026-05-28 --spot 24512 --json-file examples/nifty_option_chain.json
After package install:
gamma-wall --symbol NIFTY --expiry 2026-05-28 --spot 24512 --json-file examples/nifty_option_chain.json
Multiple symbols:
gamma-wall --symbol NIFTY,BANKNIFTY --expiry 2026-05-28 --spot NIFTY=24512,BANKNIFTY=53200 --json-file "data/{symbol}.json"
URL input:
gamma-wall --symbol NIFTY --expiry 2026-05-28 --spot 24512 --url "https://example.com/option-chain/{symbol}?expiry={expiry}"
Python Usage
Offline JSON example:
python examples/quickstart.py
Minimal Nubra snapshot integration:
from nubra_python_sdk.marketdata.market_data import MarketData
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from gamma_wall import print_gex
nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)
market_data = MarketData(nubra)
result = market_data.option_chain("NIFTY", exchange="NSE")
print_gex(result, symbol="NIFTY")
print_gex() reads result.chain.current_price, result.chain.ce, and result.chain.pe from the Nubra SDK response. If you want to override spot manually, pass spot_price=24512.
For local editable development:
python -m pip install -e .
Live Nubra SDK example:
python nubra_live_gex.py
The live script is standalone and can be opened directly in IDLE. Edit the constants at the top:
SYMBOL = "NIFTY"
EXCHANGE = "NSE"
EXPIRY = ""
SPOT_PRICE = None
If SPOT_PRICE is None, the script asks for the current spot price when it runs. It does not use spot fallback inference.
The live script imports Nubra SDK, fetches:
result = market_data.option_chain("NIFTY", exchange="NSE")
Then feeds result directly into its local GEX functions:
gex_df = calculate_gex(result, spot_price)
aggregated = aggregate_by_strike(gex_df)
print_report(...)
Expected JSON
The script supports flat contract rows:
[
{
"strike": 24500,
"option_type": "CE",
"gamma": 0.00035,
"oi": 700000,
"ltp": 180.5,
"iv": 13.2
}
]
It also handles common option-chain wrappers such as data, option_chain, records, contracts, and strike rows with nested CE / PE objects.
Calculation
GEX = gamma * OI * spot_price^2
Put GEX is multiplied by -1.
Net GEX per strike:
net_gex = call_gex + put_gex
Output
The report includes:
- Top gamma walls sorted by absolute net gamma
- Strongest positive gamma wall
- Strongest negative gamma wall
- Gamma flip zone
- Dealer positioning bias
- Total market gamma
- Top 5 call walls
- Top 5 put walls
Build for PyPI
python -m pip install --upgrade build twine
python -m build
python -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gamma_wall-0.1.0.tar.gz.
File metadata
- Download URL: gamma_wall-0.1.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e7b947a7f77e3492ce21770787d700b8995b0fad4bc62479bcaa92634be1b8
|
|
| MD5 |
3746a68b66450eba5bc7614dcfa995d5
|
|
| BLAKE2b-256 |
a9466239c20e2359ce41d6bb4a894ff8b747656a68148ca77f477571d3e1aeb3
|
File details
Details for the file gamma_wall-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gamma_wall-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7526e7adbd744b4bde97321de9b076adf6126c902269bf4e9abc28f61524df6
|
|
| MD5 |
820df59e85e1f71996dee1425bb623a5
|
|
| BLAKE2b-256 |
80afa0b871cbd2c919bd296db07ef81cca4a61873908925521a4c5e3e119284b
|