Read Portfolio Summary
Read portfolio level summary numbers such as M2M, PNL, position counts and order counts for a pseudo account.
https://apix.stocksdeveloper.in/trading/readPortfolioSummary 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
Excel
Signature
Excel exposes one function per statistic. They all take the same argument:
Public Function GetPortfolioMtm(pseudoAccount As String) As DoubleEvery 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.
| Field | Type | Description |
|---|---|---|
getPortfolioMtm | float | Portfolio M2M (position category DAY). |
getPortfolioPnl | float | Portfolio PNL (position category DAY). |
getPortfolioPositionCount | int | Position count (position category DAY). |
getPortfolioOpenPositionCount | int | Open position count (position category DAY). |
getPortfolioClosedPositionCount | int | Closed position count (position category DAY). |
getPortfolioOpenShortQuantity | int | Open short quantity (position category DAY). |
getPortfolioOpenLongQuantity | int | Open long quantity (position category DAY). |
getPortfolioMtmNET | float | Portfolio M2M (position category NET). |
getPortfolioPnlNET | float | Portfolio PNL (position category NET). |
getPortfolioPositionCountNET | int | Position count (position category NET). |
getPortfolioOpenPositionCountNET | int | Open position count (position category NET). |
getPortfolioClosedPositionCountNET | int | Closed position count (position category NET). |
getPortfolioOpenShortQuantityNET | int | Open short quantity (position category NET). |
getPortfolioOpenLongQuantityNET | int | Open long quantity (position category NET). |
getPortfolioOrderCount | int | Total order count. |
getPortfolioOpenOrderCount | int | ”Open” order count. |
getPortfolioCompleteOrderCount | int | ”Complete” order count. |
getPortfolioCancelledOrderCount | int | ”Cancelled” order count. |
getPortfolioRejectedOrderCount | int | ”Rejected” order count. |
getPortfolioTriggerPendingOrderCount | int | ”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.
Thanks for the feedback. Still stuck? Contact support.
Last updated 20 June 2026