Positions¶
Use positions(version="V2") 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.
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
nubra = InitNubraSdk(NubraEnv.UAT, env_creds=True)
portfolio = NubraPortfolio(nubra)
result_v1 = portfolio.positions()
result_v2 = portfolio.positions(version="V2")
Accessing Data¶
print(result_v2.portfolio.client_code)
print(result_v2.portfolio.position_stats.total_pnl)
print(result_v2.portfolio.position_stats.total_pnl_chg)
if result_v2.portfolio.positions:
first_position = result_v2.portfolio.positions[0]
print(first_position.symbol)
print(first_position.buy_quantity)
print(first_position.sell_quantity)
print(first_position.net_quantity)
print(first_position.pnl)
Request Contract¶
| Input | Meaning |
|---|---|
positions(version="V2") |
fetch V2 positions with buy/sell breakdown |
Response Contract¶
| Field | Type | Meaning |
|---|---|---|
message |
str |
response message |
portfolio.client_code |
str |
trading account client code |
portfolio.position_stats.total_pnl |
int |
total PnL |
portfolio.position_stats.total_pnl_chg |
float |
total PnL percentage change |
portfolio.positions |
list[PositionStructV2] |
flattened position list |
Response Meaning¶
Important position-level fields include:
| Field | Meaning |
|---|---|
ref_id |
instrument reference ID |
symbol |
tradable symbol |
exchange |
exchange such as NSE or BSE |
asset or asset_type |
instrument asset classification |
product or delivery_type |
product or delivery bucket |
order_side |
direction associated with the position |
quantity or net_quantity |
net position quantity |
buy_quantity |
total buy quantity in V2 |
sell_quantity |
total sell quantity in V2 |
last_traded_price |
latest price field used for live position valuation |
avg_price, avg_buy_price, avg_sell_price |
average trade prices |
pnl |
current position profit or loss |
pnl_chg |
percentage change in PnL |
Important Rules¶
Important Rules
- Use
positions(version="V2")for the documented response shape on this page. - 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.