AccountChanges¶
-
class
oandapyV20.endpoints.accounts.
AccountChanges
(accountID, params=None)¶ Bases:
oandapyV20.endpoints.accounts.Accounts
AccountChanges.
Endpoint used to poll an Account for its current state and changes since a specified TransactionID.
-
ENDPOINT
= 'v3/accounts/{accountID}/changes'¶
-
EXPECTED_STATUS
= 200¶
-
METHOD
= 'GET'¶
-
__init__
(accountID, params=None)¶ Instantiate an AccountChanges request.
Parameters: - accountID (string (required)) – id of the account to perform the request on.
- params (dict (optional)) – query params to send, check developer.oanda.com for details.
Query Params example:
{ "sinceTransactionID": 2308 }
>>> import oandapyV20 >>> import oandapyV20.endpoints.accounts as accounts >>> client = oandapyV20.API(access_token=...) >>> params = ... >>> r = accounts.AccountChanges(accountID=..., params=params) >>> client.request(r) >>> print r.response
Output:
{ "state": { "trades": [], "marginCloseoutNAV": "33848.2663", "marginUsed": "0.0000", "marginAvailable": "33848.2663", "marginCallPercent": "0.00000", "NAV": "33848.2663", "marginCloseoutMarginUsed": "0.0000", "orders": [], "withdrawalLimit": "33848.2663", "marginCloseoutPercent": "0.00000", "positions": [], "unrealizedPL": "0.0000", "marginCallMarginUsed": "0.0000", "marginCloseoutUnrealizedPL": "0.0000", "positionValue": "0.0000" }, "changes": { "tradesReduced": [], "tradesOpened": [], "ordersFilled": [], "tradesClosed": [], "transactions": [ { "price": "1.20000", "stopLossOnFill": { "timeInForce": "GTC", "price": "1.22000" }, "timeInForce": "GTC", "reason": "CLIENT_ORDER", "id": "2309", "batchID": "2309", "triggerCondition": "TRIGGER_DEFAULT", "positionFill": "DEFAULT", "userID": 1435156, "instrument": "EUR_USD", "time": "2016-10-25T21:07:21.065554321Z", "units": "-100", "type": "LIMIT_ORDER", "accountID": "101-004-1435156-001" } ], "ordersCreated": [ { "partialFill": "DEFAULT_FILL", "price": "1.20000", "stopLossOnFill": { "timeInForce": "GTC", "price": "1.22000" }, "timeInForce": "GTC", "createTime": "2016-10-25T21:07:21.065554321Z", "triggerCondition": "TRIGGER_DEFAULT", "positionFill": "POSITION_DEFAULT", "id": "2309", "instrument": "EUR_USD", "state": "PENDING", "units": "-100", "type": "LIMIT" } ], "positions": [], "ordersTriggered": [], "ordersCancelled": [] }, "lastTransactionID": "2309" }
-