TransactionIDRange

class oandapyV20.endpoints.transactions.TransactionIDRange(accountID, params=None)

Bases: oandapyV20.endpoints.transactions.Transactions

TransactionIDRange.

Get a range of Transactions for an Account based on Transaction IDs.

ENDPOINT = 'v3/accounts/{accountID}/transactions/idrange'
EXPECTED_STATUS = 200
METHOD = 'GET'
__init__(accountID, params=None)

Instantiate an TransactionIDRange request.

Parameters:
  • accountID (string (required)) – id of the account to perform the request on.
  • params (dict (required)) – query params to send, check developer.oanda.com for details.

Query Params example:

{
  "to": 2306,
  "from": 2304
}
>>> import oandapyV20
>>> import oandapyV20.endpoints.transactions as trans
>>> client = oandapyV20.API(access_token=...)
>>> params =
        {
          "to": 2306,
          "from": 2304
        }
>>> r = trans.TransactionIDRange(accountID=..., params=params)
>>> client.request(r)
>>> print r.response

Output:

{
  "lastTransactionID": "2311",
  "transactions": [
    {
      "price": "1.20000",
      "stopLossOnFill": {
        "timeInForce": "GTC",
        "price": "1.22000"
      },
      "timeInForce": "GTC",
      "reason": "CLIENT_ORDER",
      "id": "2304",
      "batchID": "2304",
      "triggerCondition": "TRIGGER_DEFAULT",
      "positionFill": "DEFAULT",
      "userID": 1435156,
      "instrument": "EUR_USD",
      "time": "2016-10-24T21:48:18.593753865Z",
      "units": "-100",
      "type": "LIMIT_ORDER",
      "accountID": "101-004-1435156-001"
    },
    {
      "orderID": "2304",
      "batchID": "2305",
      "clientExtensionsModify": {
        "comment": "myComment",
        "id": "myID"
      },
      "time": "2016-10-25T15:56:43.075594239Z",
      "type": "ORDER_CLIENT_EXTENSIONS_MODIFY",
      "userID": 1435156,
      "id": "2305",
      "accountID": "101-004-1435156-001"
    },
    {
      "orderID": "2304",
      "clientOrderID": "myID",
      "reason": "CLIENT_REQUEST_REPLACED",
      "batchID": "2306",
      "time": "2016-10-25T19:45:38.558056359Z",
      "type": "ORDER_CANCEL",
      "replacedByOrderID": "2307",
      "userID": 1435156,
      "id": "2306",
      "accountID": "101-004-1435156-001"
    }
  ]
}