Skip to main content
GET 

/us/portfolio/holdings

Get Holdings

API to retrieve the US stocks held in the user's account. Prices are in USD, and quantities can be fractional. Each holding is valued at the last traded price. If market data is unavailable, holdings are still returned with the price, value and P&L fields set to null.

Request​

curl --location 'https://api.upstox.com/v2/us/portfolio/holdings' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'

For samples in other languages, see the Sample Code section on this page.

Responses​

Response Body​

{
"status": "success",
"data": [
{
"instrument_key": "US_EQ|AAPL",
"trading_symbol": "AAPL",
"company_name": "Apple Inc.",
"exchange": "US_EQ",
"average_price": 180.25,
"quantity": 1.5,
"available_quantity": 1.5,
"transaction_type": "long",
"invested_value": 270.38,
"last_price": 230.00,
"previous_close": 232.00,
"current_value": 345.00,
"pnl": 74.63,
"day_pnl": -3.00
}
]
}
NameTypeDescription
statusstringOutcome of the request. Typically success.
dataobject[]List of US stocks holdings.
data[].instrument_keystringUS instrument key, for example US_EQ|AAPL.
data[].trading_symbolstringTicker symbol of the stock.
data[].company_namestringCompany name.
data[].exchangestringSegment of the holding. Always US_EQ.
data[].average_pricenumberAverage buy price in USD.
data[].quantitynumberShares held. Can be fractional.
data[].available_quantitynumberShares free to sell.
data[].transaction_typestringPosition direction. Possible values: long, short.
data[].invested_valuenumberquantity × average_price, in USD.
data[].last_pricenumberLast traded price in USD. null when market data is unavailable.
data[].previous_closenumberPrevious close in USD. null when market data is unavailable.
data[].current_valuenumberquantity × last_price, in USD. null when last_price is null.
data[].pnlnumberUnrealised P&L in USD: current_value minus invested_value. Negated for a short position.
data[].day_pnlnumberToday's P&L in USD: quantity × (last_price minus previous_close). Negated for a short position. null when either price is unavailable.

Sample Code​

Get US stocks holdings​

import requests

url = 'https://api.upstox.com/v2/us/portfolio/holdings'
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}',
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())