OpenTrades

class oandapyV20.endpoints.trades.OpenTrades(accountID)

Bases: oandapyV20.endpoints.trades.Trades

Get the list of open Trades for an Account.

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

Instantiate an OpenTrades request.

Parameters:accountID (string (required)) – id of the account to perform the request on.
>>> import oandapyV20
>>> import oandapyV20.endpoints.trades as trades
>>> client = oandapyV20.API(access_token=...)
>>> r = trades.OpenTrades(accountID=...)
>>> client.request(r)
>>> print r.response

Output:

{
  "trades": [
    {
      "instrument": "DE30_EUR",
      "financing": "0.0000",
      "openTime": "2016-10-28T14:28:05.231759081Z",
      "initialUnits": "10",
      "currentUnits": "10",
      "price": "10678.3",
      "unrealizedPL": "136.0000",
      "realizedPL": "0.0000",
      "state": "OPEN",
      "id": "2315"
    }
  ],
  "lastTransactionID": "2317"
}