NeoCharts
Trading

Portfolio

The positions stream and account funds/margin snapshot — both read-only, broker-driven.

positionsStreamer

Positions have no place/modify/cancel calls — your app pushes to positionsStreamer whenever the broker reports a change, and the SDK never polls or writes back.

Stream<String> get positionsStreamer;

Must be a broadcast stream — same requirement as ordersStreamer.

Emits a JSON list of position objects:

[
  {
    "symID": "RELIANCE",
    "displayName": "Reliance Industries",
    "netQty": 10,
    "avgPrice": 2405.0,
    "netOrgAvgPrice": 2405.0,
    "realizedPnl": 0.0,
    "realizedOrgPnl": 0.0,
    "multiplier": 1.0,
    "priceFactor": 1.0,
    "productType": "intraday",
    "symbol": { "id": "RELIANCE", "name": "Reliance Industries" }
  }
]
FieldTypeAccepted values
symIDStringrequired; the symbol this position is for — note the key is symID, not symbolId
displayNameStringoptional; display name, falls back to symID if omitted
netQtyintrequired; net quantity, sign carries long/short
avgPricedoublerequired; average entry price
netOrgAvgPricedoublerequired; average entry price before any partial exits
realizedPnldoublerequired; realized P&L
realizedOrgPnldoublerequired; realized P&L before any partial exits
multiplierdoublerequired; contract multiplier, 1.0 if not applicable
priceFactordoublerequired; price scaling factor, 1.0 if not applicable
productTypeStringrequired; "normal" or "intraday" — the same symbol can have two simultaneous positions under different product types
symbolobjectrequired; full symbolInfo shape

These fields are derived by the SDK, never sent by the host:

FieldTypeDerivation
positionSide"long" | "short" | nullsign of netQty — null when netQty is 0
positionTypes"Open" | "Close""Close" when netQty is 0, "Open" otherwise
orderAction"Buy" | "Sell""Sell" when netQty is negative, "Buy" otherwise — mirrors positionSide's direction (the side that opened the position), not the exit side; the SDK's own exit-order UI inverts it (buy↔sell) to pre-fill the opposite-side exit order
unrealizedPLdouble(dayClose - netOrgAvgPrice) * netQty * multiplier * priceFactor, recomputed on every market-data tick for the position's symbol; reads 0 until the first tick arrives
pnldoubleunrealizedPL + realizedOrgPnl
mtmdouble(dayClose - avgPrice) * netQty * multiplier * priceFactor + realizedPnl

fundsData

A snapshot of the account's fund/margin details — fetched on demand each time the user opens the chart drawer's Funds panel, not cached at startup or polled.

Future<String> get fundsData;
{
  "availableMargin": 347500.0,
  "usedMargin": 152500.0
}
FieldTypeAccepted values
availableMargindoubleoptional; margin available to trade with, defaults to 0 if omitted or not a number
usedMargindoubleoptional; margin already committed to open positions/orders, defaults to 0 if omitted or not a number

totalBalance (derived, not sent): availableMargin + usedMargin, computed client-side — there is no separate wire field for it.

On this page