As well as listing all the individual open trades on the account, in Instrument.Orders, the framework also calculates a total net position for each market. The Instrument.Positions collection is a Dictionary of FXB.Position objects keyed by their instrumentId properties.
(If the trading account is singleNetPosition:true, then the Positions collection should simply match the list of open trades because the back-end platform will only report one trade per market.)
The Instrument.Positions collection only contains entries for markets which have pending orders or open trades. If there is no open order/trade on a market, then it will have no entry in the Instrument.Positions collection.
However, the collection provides the following helper function for working with individual markets:
| Instrument.Positions. | Description |
| getOrEmpty(x) | Extends the standard Dictionary get(), and returns an object representing no position if the market with instrumentId=x has no open trades or pending orders, and so no entry in the dictionary. The no-position object has positionType:EMPTY and zero for all values. |
To watch for changes in positions and their profit, you can use an OnMessage() handler.