Skip to main content

Reference-data helpers for Nubra InstrumentData option, future, and underlying DataFrames

Project description

nubra_ref_data

nubra_ref_data is a small helper package for Nubra InstrumentData users who want filtered pandas DataFrames for:

  • the underlying row
  • futures rows
  • option rows by expiry bucket and strike levels
  • one combined DataFrame containing all of the above

It is designed to work with:

from nubra_python_sdk.refdata.instruments import InstrumentData

instruments = InstrumentData(nubra)

Install

pip install nubra_ref_data

Functions

  • underlying_data(instruments, underlying, exchange="NSE")
  • futures_data(instruments, underlying, exchange="NSE")
  • options_data(instruments, underlying, exchange="NSE", expiry_bucket="week0", levels=10, option_side="BOTH")
  • all_data(instruments, underlying, exchange="NSE", expiry_bucket="week0", levels=10, option_side="BOTH")

Example

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.refdata.instruments import InstrumentData

from nubra_ref_data import all_data, futures_data, options_data, underlying_data


nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)
instruments = InstrumentData(nubra)

df_underlying = underlying_data(
    instruments=instruments,
    underlying="NIFTY",
    exchange="NSE",
)
print("UNDERLYING")
print(df_underlying)

df_futures = futures_data(
    instruments=instruments,
    underlying="NIFTY",
    exchange="NSE",
)
print("FUTURES")
print(df_futures)

df_options = options_data(
    instruments=instruments,
    underlying="NIFTY",
    exchange="NSE",
    expiry_bucket="week0",
    levels=5,
    option_side="BOTH",
)
print("OPTIONS")
print(df_options)

df_all = all_data(
    instruments=instruments,
    underlying="NIFTY",
    exchange="NSE",
    expiry_bucket="week0",
    levels=5,
    option_side="BOTH",
)
print("ALL DATA")
print(df_all)

df_sensex = all_data(
    instruments=instruments,
    underlying="SENSEX",
    exchange="BSE",
    expiry_bucket="week0",
    levels=6,
    option_side="BOTH",
)
print("SENSEX BSE")
print(df_sensex)

Example Output

PyPI will render this section too, so users can see the expected shape before installing.

UNDERLYING
      stock_name   ref_id exchange    asset asset_type derivative_type expiry strike_price option_type lot_size tick_size token            nubra_name         isin underlying_prev_close
0          NIFTY  1234567      NSE    NIFTY      INDEX                      <NA>         <NA>        <NA>     <NA>      <NA>  <NA>   INDEX_NIFTY.NSECM          N/A             2245000

FUTURES
       stock_name   ref_id exchange asset asset_type derivative_type    expiry strike_price option_type  lot_size  tick_size  token              nubra_name isin  underlying_prev_close
0  NIFTY24APRFUT  2233445      NSE NIFTY   INDEX_FO             FUT  20260424           -1        <NA>        75         10  45678  FUT_NIFTY_20260424  N/A                2245000

OPTIONS
         stock_name   ref_id exchange asset asset_type derivative_type    expiry  strike_price option_type  lot_size  tick_size  token                     nubra_name isin  underlying_prev_close
0  NIFTY24APR22400CE  2233501      NSE NIFTY   INDEX_FO             OPT  20260424       2240000          CE        75          5  45690  OPT_NIFTY_20260424_CE_2240000  N/A                2245000
1  NIFTY24APR22450CE  2233502      NSE NIFTY   INDEX_FO             OPT  20260424       2245000          CE        75          5  45691  OPT_NIFTY_20260424_CE_2245000  N/A                2245000
2  NIFTY24APR22450PE  2233503      NSE NIFTY   INDEX_FO             OPT  20260424       2245000          PE        75          5  45692  OPT_NIFTY_20260424_PE_2245000  N/A                2245000
3  NIFTY24APR22400PE  2233504      NSE NIFTY   INDEX_FO             OPT  20260424       2240000          PE        75          5  45693  OPT_NIFTY_20260424_PE_2240000  N/A                2245000

Behavior

  • week0, week1, week2, week3, and week4 resolve against the sorted available option expiries for that underlying.
  • month resolves to the first month-end expiry available in the option data.
  • levels picks the nearest strikes using underlying_prev_close.
  • option_side="BOTH" only selects strikes where both CE and PE exist.
  • all_data() returns rows in this order: underlying, futures, then options.
  • If the underlying cash/index row is missing from the instruments master, a placeholder UNDERLYING row is added.
  • The returned DataFrames preserve the original instrument columns only. No helper columns are added.

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_ref_data-0.1.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

nubra_ref_data-0.1.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file nubra_ref_data-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for nubra_ref_data-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aff47252afd9463033baab15ab4374a1c457071f8fa5b62674227b223f5f22ca
MD5 a1c8b6fa300b4a75dc02050c093f07e4
BLAKE2b-256 35440227a7d986feb155b3d93fb92cced72e050b330846772bb5c07a703673f1

See more details on using hashes here.

File details

Details for the file nubra_ref_data-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nubra_ref_data-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for nubra_ref_data-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8583f93ff14e21a92b10afd64b52207534145be0e915bd557c43b387fd022c55
MD5 2274af133513f0f9742ca7ad45a8eeb1
BLAKE2b-256 422fd2c045558b66c3563b2c538476a5cc19cb7d3fd5250be21b3d133a736bb6

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