Holdings¶
Use holdings() to fetch the current holdings snapshot for the linked account, including invested value, current value, PnL, haircut, pledge-related fields, and holding-level metadata.
LLM guidance
Use this page for demat inventory and collateral-aware holdings state, not for order placement or intraday execution tracking. Holdings are fetched snapshots of what the account currently owns.
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.holdings()
holdings() returns the Trading API V3 holdings snapshot with the response fields documented below.
Accessing Data¶
print(result.portfolio.clientCode)
print(result.portfolio.holdingStats.investedAmount)
print(result.portfolio.holdingStats.totalPnl)
print(result.portfolio.holdingStats.dayPnl)
if result.portfolio.holdings:
holding = result.portfolio.holdings[0]
print(holding.symbol)
print(holding.quantity)
print(holding.avgPrice)
print(holding.prevClose)
print(holding.lastTradedPrice)
print(holding.currentValue)
print(holding.netPnl)
print(holding.marginBenefit)
print(holding.availableToPledge)
Request Contract¶
| Input | Meaning |
|---|---|
NubraPortfolio(nubra).holdings() |
fetch the Trading API V3 holdings snapshot |
Response Contract¶
| Field | Type | Meaning |
|---|---|---|
message |
str |
response message |
portfolio.clientCode |
str |
demat-linked client code |
portfolio.holdingStats.investedAmount |
int |
total invested amount |
portfolio.holdingStats.currentValue |
int |
current market value |
portfolio.holdingStats.totalPnl |
int |
total PnL |
portfolio.holdingStats.totalPnlChg |
float |
total PnL percentage change |
portfolio.holdingStats.dayPnl |
int |
day PnL |
portfolio.holdingStats.dayPnlChg |
float |
day PnL percentage change |
portfolio.holdings |
list[Holding] |
holding-level records |
Response Meaning¶
Important holding-level fields include:
| Field | Meaning |
|---|---|
refId |
instrument reference ID |
symbol |
tradable symbol |
quantity |
current held quantity |
pledgedQty |
quantity already pledged |
t1Qty |
unsettled T+1 quantity |
avgPrice |
average acquisition price |
prevClose |
previous close |
lastTradedPrice |
latest traded price |
investedValue |
invested amount for the holding |
currentValue |
current marked-to-market value |
netPnl |
net holding PnL |
dayPnl |
day holding PnL |
haircut |
haircut used for collateral valuation |
marginBenefit |
margin value available from the holding |
availableToPledge |
quantity still available to pledge |
isPledgeable |
whether the holding is eligible for pledge |
Important Rules¶
Important Rules
- Holdings are account-state snapshots. The response does not auto-update after it is returned.
- Use
NubraPortfolio(nubra).holdings()for Trading API V3 holdings. - Holding price, value, and PnL fields are typically returned in exchange-native integer units such as paise for NSE instruments.
pledgedQty,availableToPledge, andisPledgeableare holding-specific operational fields and may be absent for instruments where they do not apply.- Use holdings for demat inventory and collateral context, not for intraday order-state tracking.
- Use environment-correct login and account context. UAT and PROD holdings are separate.