Read Portfolio Summary

Read portfolio level summary numbers such as M2M, PNL, position counts and order counts for a pseudo account.

GET https://apix.stocksdeveloper.in/trading/readPortfolioSummary
ReadReturns a portfolio summary3 languagesRate limited · cache resultsBroker independent
In short

Read Portfolio Summary returns portfolio level summary numbers for a pseudo account, such as M2M, PNL, position counts and order counts. These functions exist in the desktop client libraries (AmiBroker, MetaTrader and Excel). Other libraries return the full portfolio as a collection of records, so you can compute these values yourself. Cache the result and reuse it to stay within the rate limits.

This call reads portfolio level summary numbers for the trading account linked to a pseudo account. It exists to save you work: the other libraries return the full portfolio as a collection of records, and these summary values can be computed from that collection.

Each function takes a single parameter, the pseudo account, and returns one statistic. The NET variants use position category NET; the others use position category DAY. The full list is under Summary fields.

Code samples

Samples

Excel

Signature

Excel exposes one function per statistic. They all take the same argument:

Public Function GetPortfolioMtm(pseudoAccount As String) As Double

Every statistic in Summary fields has a matching GetPortfolio<Stat> function (for example GetPortfolioPnl, GetPortfolioPositionCount, GetPortfolioOrderCount).

AmiBroker

Signature

AmiBroker exposes one function per statistic. They all take the same argument:

function getPortfolioMtm(pseudoAccount)

Example

mtm = getPortfolioMtm("XX1234");

pnl = getPortfolioPnl("XX1234");

openOrderCount = getPortfolioOpenOrderCount("XX1234");

Every statistic in Summary fields has a matching getPortfolio<Stat> function.

MetaTrader

Signature

MetaTrader exposes one function per statistic. They all take the same argument:

double getPortfolioMtm(string pseudoAccount)

Example

double mtm = getPortfolioMtm("XX1234");

double pnl = getPortfolioPnl("XX1234");

long openOrderCount = getPortfolioOpenOrderCount("XX1234");

Every statistic in Summary fields has a matching getPortfolio<Stat> function.

Summary fields

Each call returns one portfolio statistic. The statistics are the same across every language: AmiBroker, MetaTrader and Excel each expose a getPortfolio<Stat> function. The NET variants use position category NET; the others use position category DAY.

FieldTypeDescription
getPortfolioMtmfloatPortfolio M2M (position category DAY).
getPortfolioPnlfloatPortfolio PNL (position category DAY).
getPortfolioPositionCountintPosition count (position category DAY).
getPortfolioOpenPositionCountintOpen position count (position category DAY).
getPortfolioClosedPositionCountintClosed position count (position category DAY).
getPortfolioOpenShortQuantityintOpen short quantity (position category DAY).
getPortfolioOpenLongQuantityintOpen long quantity (position category DAY).
getPortfolioMtmNETfloatPortfolio M2M (position category NET).
getPortfolioPnlNETfloatPortfolio PNL (position category NET).
getPortfolioPositionCountNETintPosition count (position category NET).
getPortfolioOpenPositionCountNETintOpen position count (position category NET).
getPortfolioClosedPositionCountNETintClosed position count (position category NET).
getPortfolioOpenShortQuantityNETintOpen short quantity (position category NET).
getPortfolioOpenLongQuantityNETintOpen long quantity (position category NET).
getPortfolioOrderCountintTotal order count.
getPortfolioOpenOrderCountint”Open” order count.
getPortfolioCompleteOrderCountint”Complete” order count.
getPortfolioCancelledOrderCountint”Cancelled” order count.
getPortfolioRejectedOrderCountint”Rejected” order count.
getPortfolioTriggerPendingOrderCountint”Trigger pending” order count.

Notes

These summary functions are available in the desktop client libraries (AmiBroker, MetaTrader and Excel). In the other libraries, read the full portfolio with Read Positions and Read Orders, then compute these values from the returned records.

It is recommended to cache the portfolio and reuse it, to avoid hitting the API rate limits.

Was this page helpful?

Last updated 20 June 2026