Skip to content

About

Official documentation for Nubra's Python SDK for trading and market-data APIs, including UAT sandbox testing. Install with pip install nubra-sdk.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Nubra Python SDK: Examples for Algo Trading, Market Data and Options

Ask DeepWiki

Runnable Python examples for the Nubra Python SDK V3 (nubra-sdk 0.5.x). Place orders, stream live prices, pull option chains and historical candles, and track your portfolio on NSE, BSE and MCX. Every example runs on the UAT sandbox first.

This repo holds runnable examples, the guide, snippets and response schemas. The SDK itself installs from PyPI as nubra-sdk and imports as nubra_python_sdk; its source code is not in this repo.

105 examples · 8-page guide · Requires Python 3.7+ (examples tested on 3.12) · tested on nubra-sdk 0.5.4 · UAT sandbox by default · MIT licensed

Install

python -m pip install nubra-sdk
# upgrade
python -m pip install --upgrade nubra-sdk

Quick start

from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.marketdata.market_data import MarketData

# NubraEnv.UAT is the sandbox. Switch to NubraEnv.PROD for live trading.
nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)

print(MarketData(nubra).current_price("HDFCBANK", exchange="NSE"))

env_creds=True reads PHONE_NO and MPIN from a local .env file (keep it out of git):

PHONE_NO="your-phone-number"
MPIN="your-mpin"

Without it, the SDK asks for your phone number, OTP and MPIN. See examples/authentication for OTP and institutional login.

Follow the guide

New here? Go in order. Each page links to the runnable examples and shows real UAT output.

Step Page What you get
0 Setup Install, .env, first run on UAT
1 Authentication OTP, .env and institutional login
2 Instruments Find the right contract, expiry and lot size
3 Market Data Prices, depth, option chains, history, fundamentals
4 Realtime Data Live indices, option chains, depth, Greeks, candles
5 Trading Single orders, strategies, margin, modify, cancel
6 Portfolio Funds, holdings, positions and P&L
7 Recipes and Next Steps Task lookup, worked workflows, going-live checklist

Start at the guide home.

Find an example by task

I want to... Start here
Log in (OTP, .env, institutional) examples/authentication
Get live price, quote or depth for a stock, index or MCX future examples/market_data/current_price, market_quotes
Load an option chain into pandas (ATM, PCR, max OI, IV skew) option_chain_dataframe.py
Download historical candles (stocks, indices, expired options) examples/market_data/historical_market_data
Read company fundamentals (ratios, cash flow, balance sheet) examples/market_data/company_fundamentals
Look up instruments, expiries and lot sizes examples/get_instruments
Stream live index, option chain, order book, Greeks or OHLCV examples/realtime_data
Monitor a live ATM straddle atm_straddle_monitor.py
Place a single order (limit, market, stop-loss, trailing, iceberg, GTE) examples/trading/place_order
Place a multi-leg strategy (straddle, strangle, spreads, iron condor) examples/trading/place_flexi_order
Check margin before placing an order margin_check_then_place.py
Modify, cancel or square off orders modify_order, cancel_order
Track funds, holdings, positions and P&L examples/portfolio
Switch between sandbox and live examples/uat_environment

Each folder has its own README with a file-by-file table.

Repository layout

Safety

  • Read-only examples only fetch data.
  • Streaming examples subscribe for a short, bounded time and then close the socket.
  • Mutating examples place, modify or cancel orders. Run them on NubraEnv.UAT unless you intend live trading.
  • Prices are integers in paise (116770 means Rs 1167.70). Examples print rupees for readability and keep request payloads in paise.

Test the examples on UAT

python tools/validate_examples.py     # every example parses as Python
python tools/uat_login.py             # one-time interactive UAT login (never touches PROD)
python tools/run_examples_uat.py      # run the examples against UAT, writes uat_report.json
python tools/check_sdk_version.py     # installed SDK vs the version these examples were tested on

Support

  • Product and SDK support: support@nubra.io
  • Security reports: see SECURITY.md
  • Bugs and feature requests: GitHub Issues
  • Contributing: CONTRIBUTING.md

License

MIT. See LICENSE.

About

Official documentation for Nubra's Python SDK for trading and market-data APIs, including UAT sandbox testing. Install with pip install nubra-sdk.

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages