Greeks Data¶
The greeks realtime stream delivers continuously updating option Greeks and related option fields for a subscribed option contract.
This stream supports eligible option contracts from NSE, BSE, and MCX.
LLM guidance
Use this page when the application needs live Greeks for one or more option ref_id values. Use snapshot option-chain APIs for one-time inspection instead of continuously updating Greeks.
Basic Usage¶
from nubra_python_sdk.ticker import websocketdata
from nubra_python_sdk.marketdata.market_data import MarketData
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
nubra = InitNubraSdk(NubraEnv.PROD, env_creds=True)
market_data = MarketData(nubra)
def get_atm_call_ref_id(instrument, exchange):
chain = market_data.option_chain(instrument, exchange=exchange).chain
atm_ce = next(
(opt for opt in chain.ce if opt.strike_price == chain.at_the_money_strike),
chain.ce[0],
)
return str(atm_ce.ref_id)
nse_option_ref_id = get_atm_call_ref_id("NIFTY", "NSE")
bse_option_ref_id = get_atm_call_ref_id("SENSEX", "BSE")
mcx_option_ref_id = get_atm_call_ref_id("CRUDEOIL", "MCX")
def on_greeks_data(msg):
print("[GREEKS]", msg)
def on_connect(msg):
print("[status]", msg)
def on_close(reason):
print(f"Closed: {reason}")
def on_error(err):
print(f"Error: {err}")
socket = websocketdata.NubraDataSocket(
client=nubra,
on_greeks_data=on_greeks_data,
on_connect=on_connect,
on_close=on_close,
on_error=on_error,
)
socket.connect()
socket.subscribe([nse_option_ref_id], data_type="greeks")
socket.subscribe([bse_option_ref_id], data_type="greeks")
socket.subscribe([mcx_option_ref_id], data_type="greeks")
socket.keep_running()
Subscription Contract¶
| Parameter | Type | Required | Meaning |
|---|---|---|---|
ref_ids |
list[str] |
yes | option reference IDs |
data_type |
str |
yes | must be greeks |
Response Shape¶
Response Shape
class OptionData:
ref_id: int
timestamp: int
strike_price: int
lot_size: int
last_traded_price: int | None
last_traded_price_change: float | None
iv: float | None
delta: float | None
gamma: float | None
theta: float | None
vega: float | None
volume: int | None
open_interest: int | None
previous_open_interest: int | None
Response Contract¶
| Field | Type | Meaning |
|---|---|---|
ref_id |
int |
option instrument identifier |
timestamp |
int |
event timestamp |
strike_price |
int |
strike price |
lot_size |
int |
lot size |
last_traded_price |
int |
latest traded option price |
last_traded_price_change |
float |
option price change field |
iv |
float |
implied volatility |
delta |
float |
delta |
gamma |
float |
gamma |
theta |
float |
theta |
vega |
float |
vega |
volume |
int |
traded volume |
open_interest |
int |
open interest |
previous_open_interest |
int |
previous open interest |
Implementation Notes¶
- Subscribe using option
ref_id, not the underlying symbol. - Use option
ref_idvalues resolved from the matching exchange option-chain snapshot. - This stream is useful when the application needs continuously updating sensitivity metrics.
- Use the snapshot option-chain page when you only need one-time inspection.
Important Rules
- This is a realtime stream, not a snapshot API.
greekssubscriptions require valid optionref_idvalues.- Greeks subscriptions support eligible option
ref_idvalues fromNSE,BSE, andMCX. - Use Get Instruments to retrieve the latest instrument expiries and resolve the correct option contract before subscribing by
ref_id. - Do not reuse environment-specific identifiers across UAT and PROD.
- Review Subscription Limits before opening large numbers of subscriptions.