Index Data¶
The index realtime stream delivers continuously updating market data for indices, equities, and some derivative symbols through WebSocket callbacks.
SDK 0.5.2 exposes the optional indicative_close_price field on each parsed IndexDataWrapper update when the exchange provides an indicative closing price for an applicable NSE or BSE cash-market instrument and session.
This stream can be used with supported symbols from NSE, BSE, and MCX.
When To Use This Page¶
Use this page when you need to:
- subscribe to streaming index values
- receive tick-driven updates for supported stock symbols
- monitor top-line realtime values without order-book depth
LLM guidance
This is a realtime stream, not a snapshot response. Use this page when you need continuously updating top-line values for indices, equities, or supported derivative symbols. If you only need one-time reads, use Current Price.
Basic Usage¶
from nubra_python_sdk.ticker import websocketdata
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
nubra = InitNubraSdk(NubraEnv.PROD, env_creds=True)
def on_index_data(msg):
print("[INDEX]", msg)
print("Indicative close price:", msg.indicative_close_price)
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_index_data=on_index_data,
on_connect=on_connect,
on_close=on_close,
on_error=on_error,
)
socket.connect()
socket.subscribe(["NIFTY", "HDFCBANK"], data_type="index", exchange="NSE")
socket.subscribe(["SENSEX"], data_type="index", exchange="BSE")
socket.subscribe(["FUT_CRUDEOIL_20260618"], data_type="index", exchange="MCX")
socket.keep_running()
Subscription Contract¶
| Parameter | Type | Required | Meaning |
|---|---|---|---|
symbols |
list[str] |
yes | index or supported symbol identifiers |
data_type |
str |
yes | must be index |
exchange |
str |
no | exchange override such as NSE, BSE, or MCX; defaults to NSE if supported by the stream |
Response Shape¶
Response Shape
class IndexDataWrapper:
indexname: str
exchange: str
timestamp: int
index_value: int
high_index_value: int
low_index_value: int
volume: int
changepercent: float
tick_volume: int
prev_close: int
volume_oi: int | None
indicative_close_price: int | None
Response Contract¶
| Field | Type | Meaning |
|---|---|---|
indexname |
str |
subscribed symbol or index name |
exchange |
str |
exchange name |
timestamp |
int |
event timestamp |
index_value |
int |
current streamed value |
high_index_value |
int |
session high |
low_index_value |
int |
session low |
volume |
int |
traded volume |
changepercent |
float |
percentage change from previous close |
tick_volume |
int |
tick-activity count |
prev_close |
int |
previous close |
volume_oi |
int |
OI-related value when present |
indicative_close_price |
int |
indicative closing price when provided; otherwise None |
Implementation Notes¶
- Despite the name, the
indexstream can emit updates for more than just benchmark indices. - Use dedicated callbacks when you want stream-specific processing.
- Numeric values are returned in exchange-native units where applicable.
indicative_close_priceis optional and may beNoneduring regular updates or outside the applicable indicative-price session.- The field is currently applicable to eligible NSE and BSE cash-market instruments; it is not guaranteed in every update.
Important Rules
- This is a realtime stream, not a snapshot API.
- The
indexstream name does not mean only benchmark indices are supported. - The stream can be used with eligible
NSE,BSE, andMCXsymbols. - Use the correct symbol format for the instrument you subscribe to.
- Respect session subscription-weight limits. Review Subscription Limits.