OrderCancel

class oandapyV20.endpoints.orders.OrderCancel(accountID, orderID)

Bases: oandapyV20.endpoints.orders.Orders

Cancel a pending Order in an Account.

ENDPOINT = 'v3/accounts/{accountID}/orders/{orderID}/cancel'
EXPECTED_STATUS = 200
METHOD = 'PUT'
__init__(accountID, orderID)

Instantiate an OrdersCancel request.

Parameters:
  • accountID (string (required)) – id of the account to perform the request on.
  • orderID (string (required)) – id of the account to perform the request on.

Example:

>>> import oandapyV20
>>> import oandapyV20.endpoints.orders as orders
>>> client = oandapyV20.API(access_token=...)
>>> r = orders.OrderCancel(accountID= ..., orderID=...)
>>> client.request(r)
>>> print r.response

Output:

{
  "orderCancelTransaction": {
    "orderID": "2307",
    "clientOrderID": "myID",
    "reason": "CLIENT_REQUEST",
    "batchID": "2308",
    "time": "2016-10-25T20:53:03.789670387Z",
    "type": "ORDER_CANCEL",
    "userID": 1435156,
    "id": "2308",
    "accountID": "101-004-1435156-001"
  },
  "lastTransactionID": "2308",
  "relatedTransactionIDs": [
    "2308"
  ]
}