Skip to main content

Realtime Nubra option chain dashboard with strategy highlighting

Project description

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nubra_optionschain-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nubra_optionschain-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file nubra_optionschain-0.1.0.tar.gz.

File metadata

  • Download URL: nubra_optionschain-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for nubra_optionschain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f3190116ac7b8885e806239e76ad7a4fcff00e98556b4bfd6b1fbaee6de7baf
MD5 3acbeaec0d93488a693a1024a535cf8d
BLAKE2b-256 c6b9bd40f92825475f6262c71c71390c1b163c734f18b44e18be0b865fdc2d5d

See more details on using hashes here.

File details

Details for the file nubra_optionschain-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nubra_optionschain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d11b484af5d65a31d683140c092f6a9970873d5904452495cede18cabf8f71d
MD5 29bba0e9c0e0a56ed4f522ce710d2c5a
BLAKE2b-256 72ccdb3cf60d174a68d39b77c1d49962546838d643ac4114fbecdd7cde411c8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page