In SaxoTraderGo, the list of streaming NetPositions can be expanded to reveal the underlying positions. Here is a short demonstration of how it is done.
Upon login a single NetPosition subscription is started. All accounts/single account mode is determined by the state of the account selector.
By default, all Netpositions are collapsed. Note the EURUSD Netposition:
Request to start the subscription:
The initial snapshot of Netpositions is used to populate the list and streaming updates are applied as the are received. In SaxoTraderGo, NetPositions consisting of a single position cannot be expanded and related order details are included (see AUDNZD). To allow this they use fields from the SingleAndClosedPositions FieldGroups. These entities include related order details and are only populated if the Netposition consist of a single or of closed positions.
If the user expands a Netposition, a new position subscription with a netposition filter is started.
Example of the Position subscription with a NetPositionId:
When the Netposition is contracted, the position subscription is removed. Since only a limited amount of simultaneous Position subscriptions are allowed, it is important to disable the position subscription.