AccountDetails

class oandapyV20.endpoints.accounts.AccountDetails(accountID)

Bases: oandapyV20.endpoints.accounts.Accounts

AccountDetails.

Get the full details for a single Account that a client has access to. Full pending Order, open Trade and open Position representations are provided.

ENDPOINT = 'v3/accounts/{accountID}'
EXPECTED_STATUS = 200
METHOD = 'GET'
__init__(accountID)

Instantiate an AccountDetails request.

Parameters:accountID (string (required)) – id of the account to perform the request on.
>>> import oandapyV20
>>> import oandapyV20.endpoints.accounts as accounts
>>> client = oandapyV20.API(access_token=...)
>>> r = accounts.AccountDetails(accountID)
>>> client.request(r)
>>> print r.response
{
  "account": {
    "positions": [
      {
        "short": {
          "units": "0",
          "resettablePL": "0.0000",
          "unrealizedPL": "0.0000",
          "pl": "0.0000"
        },
        "unrealizedPL": "0.0000",
        "long": {
          "units": "0",
          "resettablePL": "-3.8046",
          "unrealizedPL": "0.0000",
          "pl": "-3.8046"
        },
        "instrument": "EUR_USD",
        "resettablePL": "-3.8046",
        "pl": "-3.8046"
      },
      {
        "short": {
          "unrealizedPL": "682.0000",
          "units": "-20",
          "resettablePL": "-1744.8000",
          "tradeIDs": [
            "821",
            "823"
          ],
          "averagePrice": "9984.7",
          "pl": "-1744.8000"
        },
        "unrealizedPL": "682.0000",
        "long": {
          "units": "0",
          "resettablePL": "447.6000",
          "unrealizedPL": "0.0000",
          "pl": "447.6000"
        },
        "instrument": "DE30_EUR",
        "resettablePL": "-1297.2000",
        "pl": "-1297.2000"
      }
    ],
    "unrealizedPL": "682.0000",
    "marginCloseoutNAV": "49393.6580",
    "marginUsed": "9948.9000",
    "currency": "EUR",
    "resettablePL": "-1301.0046",
    "NAV": "49377.6580",
    "marginCloseoutMarginUsed": "9949.8000",
    "id": "101-004-1435156-001",
    "marginCloseoutPositionValue": "198996.0000",
    "openTradeCount": 2,
    "orders": [
      {
        "partialFill": "DEFAULT_FILL",
        "price": "0.87000",
        "stopLossOnFill": {
          "timeInForce": "GTC",
          "price": "0.88000"
        },
        "timeInForce": "GTC",
        "clientExtensions": {
          "comment": "myComment",
          "id": "myID"
        },
        "id": "204",
        "triggerCondition": "TRIGGER_DEFAULT",
        "replacesOrderID": "200",
        "positionFill": "POSITION_DEFAULT",
        "createTime": "2016-07-08T07:18:47.623211321Z",
        "instrument": "EUR_GBP",
        "state": "PENDING",
        "units": "-50000",
        "type": "LIMIT"
      }
    ],
    "openPositionCount": 1,
    "marginCloseoutPercent": "0.10072",
    "marginCallMarginUsed": "9949.8000",
    "hedgingEnabled": false,
    "positionValue": "198978.0000",
    "pl": "-1301.0046",
    "lastTransactionID": "833",
    "marginAvailable": "39428.7580",
    "marginRate": "0.05",
    "marginCallPercent": "0.20144",
    "pendingOrderCount": 1,
    "withdrawalLimit": "39428.7580",
    "trades": [
      {
        "instrument": "DE30_EUR",
        "financing": "0.0000",
        "openTime": "2016-07-12T09:32:18.062823776Z",
        "initialUnits": "-10",
        "currentUnits": "-10",
        "price": "9984.7",
        "unrealizedPL": "341.0000",
        "realizedPL": "0.0000",
        "state": "OPEN",
        "id": "821"
      },
      {
        "instrument": "DE30_EUR",
        "financing": "0.0000",
        "openTime": "2016-07-12T09:32:18.206929733Z",
        "initialUnits": "-10",
        "currentUnits": "-10",
        "price": "9984.7",
        "unrealizedPL": "341.0000",
        "realizedPL": "0.0000",
        "state": "OPEN",
        "id": "823"
      }
    ],
    "alias": "hootnotv20",
    "createdByUserID": 1435156,
    "marginCloseoutUnrealizedPL": "698.0000",
    "createdTime": "2016-06-24T21:03:50.914647476Z",
    "balance": "48695.6580"
  },
  "lastTransactionID": "833"
}