2.9FXB.Position object

An FXB.Position object represents all the open trades in a market aggregated up into a single net position. It has the following properties:

Property

Description

instrumentId

ID of the FXB.Instrument

positionType

Type of position - one of the values below.

longTradeCount

Number of open long trades

longVolume

Total volume on open long trades (as cash/units, not lots)

longVWAP

Average entry price for the long trades, or zero if none

shortTradeCount

Number of open short trades

shortVolume

Total volume on open short trades (as cash/units, not lots)

shortVWAP

Average entry price for the short trades, or zero if none

pendingOrderCount

Number of open pending orders for the market

netVolume

Net volume: long volume minus short volume. Therefore, directional: positive values indicate net long and negative values indicate net short.

hasHedging

Whether the position is partially or fully hedged; whether there are both long and short open trades

netVWAP

Net average entry price

profit

Current profit on all the open trades

swap

Current accumulated swap on all the open trades

commission

Commission charged on all the open trades

netProfit

Net profit: profit + swap + commission

The positionType is derived from the number of open trades and their directions. It is one of the FXB.PositionTypes enumeration:

FXB.PositionTypes.

Description

LONG

Position in the market is net-long (but may consist of both long and short trades)

SHORT

Position in the market is net-short (but may consist of both long and short trades)

FULLYHEDGED

Position is fully hedged; flat. Long volume and short volume are non-zero and exactly equal.

PENDINGONLY

No open position, but the market has pending orders

EMPTY

No open trades or pending orders. Only exists in the context of the Positions.getOrEmpty() helper function.