Skip to content

Positions

Use positions(version="V2") to fetch current positions for the account with explicit buy, sell, and net quantities while using the V3 trading flow.

LLM guidance

Use this page for fetched portfolio-position state, not for placing or modifying orders. Positions are snapshots of account state after trades and can be used for monitoring, reconciliation, and risk views.

Walkthrough Video

If the embedded video does not load, watch it on YouTube: Positions Walkthrough

Basic Usage

from nubra_python_sdk.portfolio.portfolio_data import NubraPortfolio
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.trading.trading_enum import TradingAPIVersion

nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True, trading_version=TradingAPIVersion.V3)
portfolio = NubraPortfolio(nubra)
result = portfolio.positions(version="V2")

print(result)

positions(version="V2") is the required call shape for the Sentinel-backed V3 flow. With trading_version=TradingAPIVersion.V3 enabled on the client, the SDK returns the Trading API V3 positions snapshot documented below.

Accessing Data

print(result.portfolio.clientCode)
print(result.portfolio.positionStats.totalPnl)
print(result.portfolio.positionStats.totalPnlChg)

if result.portfolio.positions:
    first_position = result.portfolio.positions[0]
    print(first_position.symbol)
    print(first_position.buyQuantity)
    print(first_position.sellQuantity)
    print(first_position.netQuantity)
    print(first_position.pnl)

Request Contract

Input Meaning
NubraPortfolio(nubra).positions(version="V2") fetch Trading API V3 positions with buy, sell, and net quantity fields

Response Contract

Field Type Meaning
message str response message
portfolio.clientCode str trading account client code
portfolio.positionStats.totalPnl int total PnL
portfolio.positionStats.totalPnlChg float total PnL percentage change
portfolio.positions list[PositionStruct] flattened position list

Response Meaning

Important position-level fields include:

Field Meaning
refId instrument reference ID
symbol tradable symbol
exchange exchange such as NSE or BSE
asset or assetType instrument asset classification
deliveryType product or delivery bucket
orderSide direction associated with the position
netQuantity net position quantity
buyQuantity total buy quantity
sellQuantity total sell quantity
lastTradedPrice latest price field used for live position valuation
avgPrice, avgBuyPrice, avgSellPrice average trade prices
pnl current position profit or loss
pnlChg percentage change in PnL

Important Rules

Important Rules

  • Use NubraPortfolio(nubra).positions(version="V2") for Trading API V3 positions.
  • In the V3 flow, version="V2" is required to hit the Sentinel positions endpoint while still returning the V3 model on the client.
  • Position price and PnL fields are typically returned in exchange-native integer units such as paise for NSE instruments.
  • Positions are account-state snapshots. The response does not auto-update after it is returned.
  • Use realtime order or market-data streams when you need continuously updating values instead of a fetched portfolio snapshot.
  • Use environment-correct login and account context. UAT and PROD portfolios are separate.
  1. Holdings
  2. Funds
  3. Get Orders
NEO Assistant