Positions
Positions¶
Use positions() to fetch current positions for the account with explicit buy, sell, and net quantities.
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.
Basic Usage¶
from nubra_python_sdk.portfolio.portfolio_data import NubraPortfolio
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
nubra = InitNubraSdk(NubraEnv.PROD, api_key_login=True)
portfolio = NubraPortfolio(nubra)
result = portfolio.positions()
print(result)
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() |
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()for Trading API V3 positions. - 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.