Metadata-Version: 2.4
Name: nubra_optionschain
Version: 0.1.0
Summary: Realtime Nubra option chain dashboard with strategy highlighting
Author: Akshay N
License: MIT
Project-URL: Homepage, https://github.com/akshayn-spec/nubra-optionschain
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: dash>=2.15
Requires-Dist: numpy>=1.24
Requires-Dist: plotly>=5.18

﻿# nubra_optionschain

Realtime option chain dashboard with strategy highlighting (Dash UI).

This library is a helper for your Nubra WebSocket code. It does not import the Nubra SDK.

## Install

```
pip install -e .
```

## Usage

```python
from queue import Queue

from nubra_python_sdk.ticker import websocketdata
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv

from nubra_optionschain import OptionChainDashboard
from nubra_optionschain.strategy import DEFAULT_TARGET_DELTAS


# Initialize the Nubra SDK client
nubra = InitNubraSdk(NubraEnv.UAT)

# Static list of instruments (also used in the dashboard dropdown)
SYMBOLS = [
    "RELIANCE:20250626",
    "NIFTY:20250626",
]

# Queue for passing websocket messages to the dashboard
updates: Queue = Queue()


def on_option_data(msg):
    updates.put(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_option_data=on_option_data,
    on_connect=on_connect,
    on_close=on_close,
    on_error=on_error,
)

socket.connect()
socket.subscribe(SYMBOLS, data_type="option", exchange="NSE")

# Start the dashboard (Dash UI)
OptionChainDashboard(
    updates=updates,
    symbols=SYMBOLS,
    strategies=["straddle", "strangle"],
    target_deltas=DEFAULT_TARGET_DELTAS,
    max_levels=10,
).run()

# Keep websocket running
socket.keep_running()
```

## Notes

- Strategy leg highlighting uses unique colors per strategy.
- Target delta is the sum of call and put deltas.
- Option chain display shows strike, LTP, delta, and OI.
