NubraNubra API
Back to Blogs
Algo TradingAPI TradingMarket Data

5-Minute Python Quickstart with Nubra SDK

Akshay Navin: Algo Trader & Content DeveloperDecember 27, 20255 min

This quickstart walks you through installing the Nubra Python SDK, authenticating securely, and getting ready to stream realtime market data, place orders with just a few lines of code, and retrieve portfolio status — all in under 5 minutes.

Nubra’s APIs are designed to be developer-first: minimal setup, intuitive workflows, and consistent patterns across streaming, trading, and portfolio access. You connect once, stream instantly, and place orders without any complexity.


Installing the Nubra Python SDK (Under a Minute)#

Installation Steps#

  1. Open Nubra API Docs
    https://nubra.io/products/api/docs/
  2. Open Python SDK Docs
    Click the Python SDK card
  3. Copy Install Command
    pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple nubra-sdk
  4. Install the SDK
    Open Command Prompt / Terminal (ensure Python is in your PATH)
    python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple nubra-sdk
  5. Done 🎉
    SDK installs in under a minute

What’s Next?#

Once installed, you’re ready to:

  • Initialize the Nubra SDK
  • Pull live market data
  • Place and manage orders
  • Retrieve portfolio and positions

Authentication & Login (Under a Minute)#

Authenticate once to establish a secure session before accessing market data, trading, or portfolio APIs.

Authentication Steps#

  1. Open Python SDK Docs
    From Nubra API Docs, click the Python SDK card
  2. Navigate to Authentication
    Go to the Authentication section
  3. Copy the Login Code
    Use the provided authentication example
  4. Select Environment
    Choose the environment you want to log into:
    • PROD — live market trading
    • UAT — simulated market environment for testing strategies
  5. Run the Code
    When prompted, enter:
    • Registered mobile number
    • OTP received on your phone
    • MPIN
  6. Done 🔐
    You are now successfully logged in

What’s Next?#

Once authenticated, you’re ready to:

  • Stream realtime market data via WebSocket
  • Place UAT or live orders
  • Retrieve funds, positions, and portfolio
  • Build fully automated execution and monitoring systems

Realtime Market Data via WebSocket (Under a Minute)#

Stream live prices directly into your code using Nubra’s realtime WebSocket APIs.

WebSocket Streaming Steps#

  1. Open Python SDK Docs
    From Nubra API Docs, click the Python SDK card
  2. Navigate to Realtime Data
    Go to the Realtime Data section
  3. Select a Stream Type
    Nubra provides 5 realtime streams:
    • Index Data
    • Greeks
    • Option Chain
    • Orderbook
    • Market Moves
  4. Copy the Index Data Example
    Index data streams basic price and volume in realtime
  5. Run the Code
    Execute the script and watch realtime data streaming instantly
  6. Done ⚡
    Realtime streaming live in under a minute

What’s Next?#

Once you’ve streamed realtime data:

  • With the addition of a few extra lines of code, you can store the incoming ticks and chart them in realtime or post-session
  • Build signal generation and strategies on top of the stored market data
  • Place orders algorithmically based on those signals
  • Retrieve portfolio, positions, and execution status programmatically

Placing Your First Order (Under a Minute)#

Place a live or UAT order using Nubra’s Trading APIs with minimal code.

Order Placement Steps#

  1. Open Guides & Examples
    Navigate to Guides and Examples — either via the card on the page or the top navigation tab
  2. Go to Place Order
    Open the Place Order card under Order Placement & Execution
  3. Select an Order Type
    Choose the order flow that fits your use-case:
    • Individual Orders — single-leg equity, futures, or options orders
    • Basket Orders — place multiple order types and instruments together in 1 single API call
    • Flexi Orders — strategy-level orders for futures & options with dynamic sizing, time windows, and modification support
    Copy the relevant sample code
  4. Run the Code
    Execute the script and head over to the Nubra Terminal to watch the order being executed
  5. Done 🚀
    Your first trade placed in under a minute

What’s Next?#

Once you can retrieve positions programmatically, you can:

  • Build position-aware strategies
  • Automate risk checks and exits
  • Track real-time P&L and exposure
  • Combine positions with realtime Greeks and market data
  • Create fully automated execution and monitoring systems

Retrieving Positions & Portfolio (Under a Minute)#

Fetch live positions, P&L, and portfolio state programmatically using Nubra’s Portfolio APIs.

Positions & Portfolio Steps#

  1. Open Python SDK Docs
    From the Nubra API Docs, click the Python SDK card
  2. Navigate to Portfolio
    Go to the Portfolio tab, which provides access to:
    • Funds & Margin
    • Holdings
    • Positions
  3. Check Funds & Margin
    Use the Funds API to view available balance, collateral, margin usage, MTM, and net margin available
  4. View Holdings
    Open the Holdings section to see invested value, current value, day & overall PnL, margin benefit, and pledge availability
  5. Go to Positions
    Navigate to the Positions section and copy the sample code
  6. Run the Code
    Execute the script to fetch live positions, quantities, average prices, and real-time P&L
  7. Done 📊
    Track funds, holdings, positions, and P&L programmatically in under a minute

What’s Next?#

Once you can retrieve positions programmatically, you can:

  • Build position-aware strategies
  • Automate risk checks and exits
  • Track real-time P&L and exposure
  • Combine positions with realtime Greeks and market data
  • Create fully automated execution + monitoring systems