• Home
  • Products
    • Login
    • Product Info
    • User Guide
    • Pricing
  • Services
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • FAQ
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions
  • Home
  • Products
    • Login
    • Product Info
    • User Guide
    • Pricing
  • Services
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • FAQ
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions

AutoTrader Web

home/Documentation/AutoTrader Web
Expand All Collapse All
  • Index
  • Getting Started
  • Portfolio Management System (PMS)
  •  Copy Trading (Master-Child Auto-Copy)
    • Master-Child Copy - Performance
  • PMS vs Master-Child
  • Trading View
  •  Supported Brokers
    • Symphony XTS
    • Zerodha
    • Angel Broking
    • Dhan
    • Aliceblue
    • Fyers
    • Nuvama
    • IIFL
    • Zebu
    • Finvasia
    • Motilal Oswal
    • Kotak
    • Mastertrust
    • Five Paisa
    • Choice Broking
    • FlatTrade
    • Tradejini
    • Upstox
    • SAS Online
    • Profitmart
  •  Client Setup
    • Desktop Client
    • AmiBroker Library
    • Excel Library or Tools
    • Java Library
    • MetaTrader Library
    • C# Library
    • Python Library
    • HTTP REST
  •  User Interface
    • User Registration
    •   Settings
      • General
      • Trading Accounts
      • Pseudo Accounts
      • Group Accounts
      • API Key
    •   AutoTrader
      • Activity
      • Instruments
    •   Trading
      • Summary
      • Positions
      • Orders
      • Margins
      • Holdings
      • Trade
    •   User
      • Account
      • Profile
  •  API (Application Programming Interface)
    • Place Regular Order
    • Place Cover Order
    • Place Bracket Order
    • Place Advanced Order
    • Cancel Order
    • Cancel Child Orders
    • Cancel All Orders
    • Modify Order
    • Modify Order Price
    • Modify Order Quantity
    • Square-off Position
    • Square-off Portfolio
    • Read Orders
    • Read Positions
    • Read Margins
    • Read Holdings
    • Read Portfolio Summary
    • Fetch All Trading Accounts
    • Create or Update Trading Account
    • Validate Trading Account Credentials
    • API Parameters
    • API Rate Limits
    • Email Limits
    • Postman
  • Pricing
  • Precautions
  •  Broker Independence
    • API Functions
    • Pseudo Account
    • Instruments (Trading Symbols)
  • Quantity Multiplier
  • Architecture

Read Holdings

1290 views July 16, 2022 Pritesh 9

API function to read holdings from your trading platform. APIs are available in AmiBroker, MetaTrader, Excel, Java, C#, Python, HTTP REST.

Api function will read holdings from Supports leading Indian Stock Brokers.

  • AmiBroker
  • MetaTrader
  • Java
  • C#
  • Python
  • HTTP

Signature

/*
* Retrieve holding exchange.
*/
function getHoldingExchange(pseudoAccount, symbol)

/*
* Retrieve holding ISIN.
*/
function getHoldingIsin(pseudoAccount, symbol)

/*
* Retrieve holding quantity.
*/
function getHoldingQuantity(pseudoAccount, symbol)

/*
* Retrieve holding T1 quantity.
*/
function getHoldingT1Quantity(pseudoAccount, symbol)

/*
* Retrieve holding PNL.
*/
function getHoldingPnl(pseudoAccount, symbol)

/*
* Retrieve holding current value.
*/
function getHoldingCurrentValue(pseudoAccount, symbol)

/*
* Retrieve holding symbol LTP.
*/
function getHoldingLtp(pseudoAccount, symbol)

/*
* Retrieve holding product.
*/
function getHoldingProduct(pseudoAccount, symbol)

/*
* Retrieve holding collateral type.
*/
function getHoldingCollateralType(pseudoAccount, symbol)

/*
* Retrieve holding collateral quantity.
*/
function getHoldingCollateralQuantity(pseudoAccount, symbol)

/*
* Retrieve holding haircut.
*/
function getHoldingHaircut(pseudoAccount, symbol)

/*
* Retrieve holding average price.
*/
function getHoldingAvgPrice(pseudoAccount, symbol)

/*
* Retrieve holding instrument token.
*/
function getHoldingInstToken(pseudoAccount, symbol)

Example

/*
* Retrieve holding exchange.
*/
exchange = getHoldingExchange(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding ISIN.
*/
isin = getHoldingIsin(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding quantity.
*/
quantity = getHoldingQuantity(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding T1 quantity.
*/
t1Quantity = getHoldingT1Quantity(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding PNL.
*/
pnl = getHoldingPnl(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding product.
*/
product = getHoldingProduct(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding collateral type.
*/
collateralType = getHoldingCollateralType(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding collateral quantity.
*/
collateralQuantity = getHoldingCollateralQuantity(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding haircut.
*/
haircut = getHoldingHaircut(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding average price.
*/
avgPrice = getHoldingAvgPrice(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding instrument token.
*/
instToken = getHoldingInstToken(AT_ACCOUNT, "WIPRO");

Signature

/*
* Reads holding file and returns a column value for the given symbol.
*/
string readHoldingColumn(string pseudoAccount, string symbol, uint columnIndex)

/*
* Retrieve holding exchange.
*/
string getHoldingExchange(string pseudoAccount, string symbol)

/*
* Retrieve holding ISIN.
*/
string getHoldingIsin(string pseudoAccount, string symbol)

/*
* Retrieve holding quantity.
*/
long getHoldingQuantity(string pseudoAccount, string symbol)

/*
* Retrieve holding T1 quantity.
*/
long getHoldingT1Quantity(string pseudoAccount, string symbol)

/*
* Retrieve holding PNL.
*/
double getHoldingPnl(string pseudoAccount, string symbol)

/*
* Retrieve holding symbol LTP.
*/
double getHoldingLtp(pseudoAccount, symbol)

/*
* Retrieve holding current value.
*/
double getHoldingCurrentValue(pseudoAccount, symbol)

/*
* Retrieve holding product.
*/
string getHoldingProduct(string pseudoAccount, string symbol)

/*
* Retrieve holding collateral type.
*/
string getHoldingCollateralType(string pseudoAccount, string symbol)

/*
* Retrieve holding collateral quantity.
*/
long getHoldingCollateralQuantity(string pseudoAccount, string symbol)

/*
* Retrieve holding haircut.
*/
double getHoldingHaircut(string pseudoAccount, string symbol)

/*
* Retrieve holding average price.
*/
double getHoldingAvgPrice(string pseudoAccount, string symbol)

/*
* Retrieve holding instrument token.
*/
double getHoldingInstToken(string pseudoAccount, string symbol)

Example

/*
* Retrieve holding exchange.
*/
string exchange = getHoldingExchange(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding ISIN.
*/
string isin = getHoldingIsin(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding quantity.
*/
long quantity = getHoldingQuantity(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding T1 quantity.
*/
long t1Quantity = getHoldingT1Quantity(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding PNL.
*/
double pnl = getHoldingPnl(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding product.
*/
string product = getHoldingProduct(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding collateral type.
*/
string collateralType = getHoldingCollateralType(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding collateral quantity.
*/
long collateralQuantity = getHoldingCollateralQuantity(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding haircut.
*/
double haircut = getHoldingHaircut(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding average price.
*/
double avgPrice = getHoldingAvgPrice(AT_ACCOUNT, "WIPRO");

/*
* Retrieve holding instrument token.
*/
double instToken = getHoldingInstToken(AT_ACCOUNT, "WIPRO");

Signature

/**
 * Read trading platform holdings from the trading account mapped to the given
 * pseudo account.
 *
 * @param pseudoAccount pseudo account id
 * @return holdings trading platform holdings
 */
IOperationResponse<Set<PlatformHolding>> readPlatformHoldings(final String pseudoAccount);

Example

IOperationResponse<Set<PlatformHolding>> response =
    this.autotrader.readPlatformHoldings("ACC_NAME");
  
Set<PlatformHolding> holdings = null;
  
if(response.success()) {
    // Extract the result
    holdings = response.getResult();
}

It is recommended to periodically download and cache the orders to avoid hitting the api limit. You can lookup the returned set and find your relevant order.

Signature

/// <summary>
/// Read trading platform holdings from the trading account mapped to the given
/// pseudo account.
/// </summary>
/// <param name="pseudoAccount"> pseudo account id </param>
/// <returns> holdings trading platform holdings </returns>
IOperationResponse<ISet<PlatformHolding>> ReadPlatformHoldings(string pseudoAccount);

Example

IOperationResponse<ISet<PlatformHolding>> response = 
	autoTrader.ReadPlatformHoldings("XX1234");
foreach (PlatformHolding h in response.Result)
	Console.WriteLine("{0}", h);

This will retrieve holdings from your trading account that is mapped to the passed pseudo account. The function will return a response object.

Response object has a function called Success(), which returns true on successful execution.

We can then use it’s Result property to get a set containing positions.

It is recommended to periodically download and cache the holdings to avoid hitting the api limit. You can lookup the returned set and find your relevant order.

PlatformHolding

Here is a look at the public methods of PlatformHolding model class:

string Isin { get; }

string CollateralType { get; }

string InstrumentToken { get; }

string Product { get; }

int? Quantity { get; }

int? CollateralQty { get; }

int? T1Qty { get; }

float? Pnl { get; }

float? Haircut { get; }

float? AvgPrice { get; }

string Exchange { get; }

string Symbol { get; }

string Platform { get; }

int? TotalQty { get; set; }

float? Ltp { get; set; }

float? CurrentValue { get; set; }

Signature

def read_platform_holdings(self, pseudo_account):

Example

response = autotrader.read_platform_holdings('XX1234')

if response.success():
	# Result will be a list of objects of type
	# com.dakshata.trading.model.platform.PlatformHolding
	for o in response.result:
		pretty = "[Pseudo acc.: {}, Trading acc.: {}, " + \
			"Exch: {}, Symbol: {}, Quantity: {}, Product: {}, ISIN: {}, " + \
			"Collateral qty.: {}, T1 qty.: {}, Collateral type: {}, Pnl: {}, Haircut: {}, " + \
			"Avg. price: {}, Inst. token: {}]"
		print(pretty.format(o.pseudo_account, o.trading_account, 
			o.exchange, o.symbol, o.quantity, o.product, o.isin, 
			o.collateral_qty, o.t1_qty, o.collateral_type, o.pnl, o.haircut, 
			o.avg_price, o.instrument_token))
		print("\n----------------------------------------------------------------------\n")
else:
	print("Message: {0}".format(response.message))

Note: Our libraries use object oriented programming in Python. The response.result object from above function will be a list of objects of class PlatformHolding. You can then iterate or loop over the list & read each object’s properties via object.property notation. You can find all available properties in PlatformHolding.py.

It is recommended to periodically download and cache the positions to avoid hitting the api limit.

Example

curl https://api.stocksdeveloper.in/trading/readPlatformHoldings \
   -H "api-key: <your_api_key>" \
   -d "pseudoAccount=ACC_NAME"

Response

{
	"result": [{
		"id": null,
		"account": null,
		"isin": "INE075A01022",
		"collateralType": "--",
		"instrumentToken": "3787",
		"product": "CNC",
		"quantity": 0,
		"collateralQty": 0,
		"t1Qty": 1,
		"pnl": null,
		"haircut": 0.0,
		"avgPrice": 0.0,
		"pseudoAccount": "XX9999",
		"tradingAccount": "XX9999",
		"stockBroker": "AliceBlue",
		"exchange": "NSE",
		"symbol": "WIPRO-EQ",
		"platform": "ANT",
		"day": [2021, 2, 24],
		"version": null
	}],
	"message": null,
	"status": true,
	"commandId": "2335425e-da65-462b-a898-6c139833bb9b"
}

The response contains result (which is an array of holdings in json format sourced from your trading platform).

If there is any error, then you will get status as false & message will have error text.

It is recommended to periodically download and cache the positions to avoid hitting the api limit.

Read Margins
Portfolio Summary

Was this helpful?

9 Yes  1 No
Related Articles
  • Master-Child Copy – Performance
  • Tradejini
  • Dhan
  • FlatTrade
  • Supported Brokers
  • Symphony XTS

© 2025 Stocks Developer. All Rights Reserved.