PositionList¶
-
class
oandapyV20.endpoints.positions.
PositionList
(accountID)¶ Bases:
oandapyV20.endpoints.positions.Positions
PositionList.
List all Positions for an Account. The Positions returned are for every instrument that has had a position during the lifetime of the Account.
-
ENDPOINT
= 'v3/accounts/{accountID}/positions'¶
-
EXPECTED_STATUS
= 200¶
-
METHOD
= 'GET'¶
-
__init__
(accountID)¶ Instantiate a PositionList request.
Parameters: accountID (string (required)) – id of the account to perform the request on. >>> import oandapyV20 >>> import oandapyV20.endpoints.positions as positions >>> accountID = ... >>> client = oandapyV20.API(access_token=...) >>> r = positions.PositionList(accountID=accountID) >>> client.request(r) >>> print r.response
Output:
{ "positions": [ { "short": { "units": "0", "resettablePL": "-272.6805", "unrealizedPL": "0.0000", "pl": "-272.6805" }, "unrealizedPL": "0.0000", "long": { "units": "0", "resettablePL": "0.0000", "unrealizedPL": "0.0000", "pl": "0.0000" }, "instrument": "EUR_GBP", "resettablePL": "-272.6805", "pl": "-272.6805" }, { "short": { "unrealizedPL": "870.0000", "tradeIDs": [ "2121", "2123" ], "resettablePL": "-13959.3000", "units": "-20", "averagePrice": "10581.5", "pl": "-13959.3000" }, "unrealizedPL": "870.0000", "long": { "units": "0", "resettablePL": "404.5000", "unrealizedPL": "0.0000", "pl": "404.5000" }, "instrument": "DE30_EUR", "resettablePL": "-13554.8000", "pl": "-13554.8000" }, { "short": { "units": "0", "resettablePL": "0.0000", "unrealizedPL": "0.0000", "pl": "0.0000" }, "unrealizedPL": "0.0000", "long": { "units": "0", "resettablePL": "-12.8720", "unrealizedPL": "0.0000", "pl": "-12.8720" }, "instrument": "EUR_USD", "resettablePL": "-12.8720", "pl": "-12.8720" } ], "lastTransactionID": "2124" }
-