Read Positions

Read live positions for any supported broker account, in a broker independent format.

GET https://apix.stocksdeveloper.in/trading/readPlatformPositions
ReadReturns live positions7 languagesRate limited · cache resultsBroker independent
In short

Read Positions returns the live positions for the trading account mapped to a pseudo account. The same call works across every client language and supported broker. Each position includes quantities, values, average prices and P&L. Cache the result and reuse it to stay within the rate limits.

This call reads positions from your trading platform. It returns data for the trading account linked to the pseudo account you pass in.

The same call is available across all supported brokers, so your code stays broker independent. See API functions for the full list.

Code samples

Samples

HTTP

Example

curl https://apix.stocksdeveloper.in/trading/readPlatformPositions \
   -H "api-key: <your-api-key>" \
   -d "pseudoAccount=ACC_NICK_NAME"

The response is JSON, in the format shown under Response. Each position carries the Position fields listed below.

Python

Signature

def read_platform_positions(self, pseudo_account):

Example

response = autotrader.read_platform_positions('ACC_NICK_NAME')

if response.success():
	# response.result is a list of PlatformPosition objects
	for p in response.result:
		print(p.independent_symbol, p.net_quantity, p.pnl)
else:
	print("Message: {0}".format(response.message))

response.result is a list of position objects. Read each field with object.property notation — every field is listed under Position fields.

Java

Signature

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

Example

IOperationResponse<Set<PlatformPosition>> response =
    this.autotrader.readPlatformPositions("ACC_NICK_NAME");

Set<PlatformPosition> positions = null;
if (response.success()) {
    positions = response.getResult();
}

Use getResult() to get the set of positions. Each PlatformPosition exposes the Position fields below through getters such as getNetQuantity().

C#

Signature

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

Example

IOperationResponse<ISet<PlatformPosition>> response = 
	autoTrader.ReadPlatformPositions("ACC_NICK_NAME");

foreach (PlatformPosition p in response.Result)
	Console.WriteLine("{0}", p);

Use the Result property to get the set of positions. Each PlatformPosition exposes the Position fields below as properties such as NetQuantity.

Excel

Signature

Excel exposes one function per field. They all take the same arguments:

Public Function GetPositionNetQuantity(pseudoAccount As String, _ 
	category As String, posType As String, independentExchange As String, _
	independentSymbol As String) As Long

Every field in Position fields has a matching GetPosition<Field> function (for example GetPositionPnl, GetPositionLtp, GetPositionBuyAvgPrice).

AmiBroker

Signature

AmiBroker exposes one function per field. They all take the same arguments:

function getPositionNetQuantity(pseudoAccount, category, type, 
	independentExchange, independentSymbol)

Example

// category can be DAY or NET
// type can be MIS, NRML, CNC, BO, CO
netQuantity = getPositionNetQuantity(AT_ACCOUNT, "DAY", "MIS", 
	AT_EXCHANGE, AT_SYMBOL);

pnl = getPositionPnl(AT_ACCOUNT, "DAY", "MIS", 
	AT_EXCHANGE, AT_SYMBOL);

Every field in Position fields has a matching getPosition<Field> function.

MetaTrader

Signature

MetaTrader exposes one function per field. They all take the same arguments:

long getPositionNetQuantity(string pseudoAccount, 
	string category, string type, Exchange independentExchange,	
	string independentSymbol)

Example

// category can be DAY or NET
// type can be MIS, NRML, CNC, BO, CO
long netQuantity = getPositionNetQuantity(AT_ACCOUNT, 
	"DAY", "MIS", AT_EXCHANGE, AT_SYMBOL);

double pnl = getPositionPnl(AT_ACCOUNT, 
	"DAY", "MIS", AT_EXCHANGE, AT_SYMBOL);

Every field in Position fields has a matching getPosition<Field> function.

Postman

Postman is a widely used tool for API testing. We provide a collection of all our APIs in Postman collection format. See the Postman collection guide to learn how to use it.

Response

The call returns an array of positions in JSON. Some platforms return two sets per instrument — a DAY set and a NET set.

{
	"result":[
		{
			"buyQuantity":1,
			"sellQuantity":1,
			"netQuantity":0,
			"type":"MIS",
			"pnl":0.0,
			"atPnl":0.0,
			"mtm":0.0,
			"buyValue":185.35,
			"sellValue":185.35,
			"netValue":0.0,
			"buyAvgPrice":185.35,
			"sellAvgPrice":185.35,
			"day":[2020,7,2],
			"pseudoAccount":"ACC_NICK_NAME",
			"tradingAccount":"XX9999",
			"stockBroker":"YOUR_BROKER",
			"exchange":"<exchange>",
			"symbol":"SBIN",
			"independentExchange":"<exchange>",
			"independentSymbol":"SBIN",
			"category":"DAY",
			"ltp":185.45,
			"platform":"PLATFORM",
			"accountId":"XX9999",
			"overnightQuantity":0,
			"multiplier":1,
			"realisedPnl":0.0,
			"unrealisedPnl":0.0
		},
		{
			"buyQuantity":1,
			"sellQuantity":1,
			"netQuantity":0,
			"type":"MIS",
			"pnl":-0.05,
			"atPnl":-0.05,
			"mtm":-0.05,
			"buyValue":225.05,
			"sellValue":225.0,
			"netValue":-0.05,
			"buyAvgPrice":225.05,
			"sellAvgPrice":225.0,
			"day":[2020,7,2],
			"pseudoAccount":"ACC_NICK_NAME",
			"tradingAccount":"XX9999",
			"stockBroker":"YOUR_BROKER",
			"exchange":"<exchange>",
			"symbol":"WIPRO",
			"independentExchange":"<exchange>",
			"independentSymbol":"WIPRO",
			"category":"NET",
			"ltp":224.2,
			"platform":"PLATFORM",
			"accountId":"XX9999",
			"overnightQuantity":0,
			"multiplier":1,
			"realisedPnl":0.0,
			"unrealisedPnl":-0.05
		}
	],
	"message":null,
	"status":true,
	"commandId":"099c75ff-6987-4d8a-b42b-5627338a94ae"
}

status is true on success. On error it is false, and message holds the error text.

Position fields

Each position carries the fields below. They are the same across every language: the libraries expose them as object properties (Python, Java, C#) or as a getPosition<Field> function (Excel, AmiBroker, MetaTrader), and the HTTP response returns them as JSON keys.

FieldTypeDescription
pseudoAccountstringThe account nickname (pseudo account) the position belongs to.
tradingAccountstringThe mapped trading account id.
stockBrokerstringThe stock broker for this account.
exchangestringBroker specific exchange.
symbolstringBroker specific symbol.
independentExchangestringBroker independent exchange.
independentSymbolstringBroker independent symbol.
buyQuantityintTotal bought quantity.
sellQuantityintTotal sold quantity.
netQuantityintNet quantity (buy minus sell).
typeenumProduct type (MIS, NRML, CNC, BO, CO).
directionenumPosition direction (LONG, SHORT, NEUTRAL).
categorystringPosition set: DAY or NET. Some brokers send NET only — see precautions.
pnlfloatNet returns, as reported by your broker.
atPnlfloatP&L calculated by AutoTrader Web.
mtmfloatMark to market returns.
realisedPnlfloatRealised intraday returns.
unrealisedPnlfloatUnrealised intraday returns.
buyValuefloatTotal value of bought quantity.
sellValuefloatTotal value of sold quantity.
netValuefloatNet value.
buyAvgPricefloatAverage price of bought quantity.
sellAvgPricefloatAverage price of sold quantity.
ltpfloatLast traded price.
overnightQuantityintQuantity carried forward overnight.
multiplierfloatQuantity multiplier used for P&L. Usually 1. Some commodity contracts use a different value, and it can be a fraction such as 0.1.
daydatePosition date.
platformenumTrading platform the position belongs to.

Notes

It is recommended to download and cache positions periodically, then look up the cached set, to avoid hitting the API rate limits.

M2M and P&L data is not available from certain brokers (see limitations). In those cases, the values you see are calculated by our system. If you notice any issue, please let us know.

Reading the multiplier

The multiplier tells you how much one unit of quantity is worth when a price moves. P&L for a position works out to quantity × multiplier × price difference.

For shares and their derivatives the multiplier is 1. Some commodity contracts use a different value, because the price is quoted for a different unit than the one the quantity is counted in. That value is not always a whole number — it can be a fraction such as 0.1.

Read this field as a decimal number, not a whole number. If your code stores it in an integer variable, a value like 0.1 will be rounded to 0 and your own P&L calculation will be wrong. Whole values are still sent without a decimal point, so 1 stays 1.

Was this page helpful?

Last updated 27 July 2026