Which API should I use?

  • Use v20 REST API only if you have a v20 account
  • Use v1 REST API if your account id contains only digits (ie. 2534253) as it is a legacy account

Position Definitions


Position is an application/json object with the following Schema:

{
    # 
    # The Position’s Instrument.
    # 
    instrument : (InstrumentName),

    # 
    # Profit/loss realized by the Position over the lifetime of the Account.
    # 
    pl : (AccountUnits),

    # 
    # The unrealized profit/loss of all open Trades that contribute to this
    # Position.
    # 
    unrealizedPL : (AccountUnits),

    # 
    # Profit/loss realized by the Position since the Account’s resettablePL was
    # last reset by the client.
    # 
    resettablePL : (AccountUnits),

    # 
    # The total amount of commission paid for this instrument over the lifetime
    # of the Account. Represented in the Account’s home currency.
    # 
    commission : (AccountUnits),

    # 
    # The details of the long side of the Position.
    # 
    long : (PositionSide),

    # 
    # The details of the short side of the Position.
    # 
    short : (PositionSide)
}

PositionSide is an application/json object with the following Schema:

{
    # 
    # Number of units in the position (negative value indicates short position,
    # positive indicates long position).
    # 
    units : (DecimalNumber),

    # 
    # Volume-weighted average of the underlying Trade open prices for the
    # Position.
    # 
    averagePrice : (PriceValue),

    # 
    # List of the open Trade IDs which contribute to the open Position.
    # 
    tradeIDs : (Array[TradeID]),

    # 
    # Profit/loss realized by the PositionSide over the lifetime of the
    # Account.
    # 
    pl : (AccountUnits),

    # 
    # The unrealized profit/loss of all open Trades that contribute to this
    # PositionSide.
    # 
    unrealizedPL : (AccountUnits),

    # 
    # Profit/loss realized by the PositionSide since the Account’s resettablePL
    # was last reset by the client.
    # 
    resettablePL : (AccountUnits)
}

CalculatedPositionState is an application/json object with the following Schema:

{
    # 
    # The Position’s Instrument.
    # 
    instrument : (InstrumentName),

    # 
    # The Position’s net unrealized profit/loss
    # 
    netUnrealizedPL : (AccountUnits),

    # 
    # The unrealized profit/loss of the Position’s long open Trades
    # 
    longUnrealizedPL : (AccountUnits),

    # 
    # The unrealized profit/loss of the Position’s short open Trades
    # 
    shortUnrealizedPL : (AccountUnits)
}