Read Positions
Read live positions for any supported broker account, in a broker independent format.
https://apix.stocksdeveloper.in/trading/readPlatformPositions 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
HTTP
Example
curl https://apix.stocksdeveloper.in/trading/readPlatformPositions \
-H "api-key: <your-api-key>" \
-d "pseudoAccount=ACC_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('XX1234')
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_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("XX1234");
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 LongEvery 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":"XX9999",
"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":"XX9999",
"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.
| Field | Type | Description |
|---|---|---|
pseudoAccount | string | The pseudo account the position belongs to. |
tradingAccount | string | The mapped trading account id. |
stockBroker | string | The stock broker for this account. |
exchange | string | Broker specific exchange. |
symbol | string | Broker specific symbol. |
independentExchange | string | Broker independent exchange. |
independentSymbol | string | Broker independent symbol. |
buyQuantity | int | Total bought quantity. |
sellQuantity | int | Total sold quantity. |
netQuantity | int | Net quantity (buy minus sell). |
type | enum | Product type (MIS, NRML, CNC, BO, CO). |
direction | enum | Position direction (LONG, SHORT, NEUTRAL). |
category | string | Position set: DAY or NET. |
pnl | float | Net returns, as reported by your broker. |
atPnl | float | P&L calculated by AutoTrader Web. |
mtm | float | Mark to market returns. |
realisedPnl | float | Realised intraday returns. |
unrealisedPnl | float | Unrealised intraday returns. |
buyValue | float | Total value of bought quantity. |
sellValue | float | Total value of sold quantity. |
netValue | float | Net value. |
buyAvgPrice | float | Average price of bought quantity. |
sellAvgPrice | float | Average price of sold quantity. |
ltp | float | Last traded price. |
overnightQuantity | int | Quantity carried forward overnight. |
multiplier | int | Quantity / lot-size multiplier used for P&L. |
day | date | Position date. |
platform | enum | Trading 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.
Thanks for the feedback. Still stuck? Contact support.
Last updated 20 June 2026