TradesList¶
-
class
oandapyV20.endpoints.trades.
TradesList
(accountID, params=None)¶ Bases:
oandapyV20.endpoints.trades.Trades
Get a list of trades for an Account.
-
ENDPOINT
= 'v3/accounts/{accountID}/trades'¶
-
EXPECTED_STATUS
= 200¶
-
METHOD
= 'GET'¶
-
__init__
(accountID, params=None)¶ Instantiate a TradesList 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:
{ "instrument": "DE30_EUR,EUR_USD" }
>>> import oandapyV20 >>> import oandapyV20.endpoints.trades as trades >>> client = oandapyV20.API(access_token=...) >>> params = { "instrument": "DE30_EUR,EUR_USD" }
>>> r = trades.TradesList(accountID=..., params=params) >>> 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": "25.0000", "realizedPL": "0.0000", "state": "OPEN", "id": "2315" }, { "instrument": "EUR_USD", "financing": "0.0000", "openTime": "2016-10-28T14:27:19.011002322Z", "initialUnits": "100", "currentUnits": "100", "price": "1.09448", "unrealizedPL": "-0.0933", "realizedPL": "0.0000", "state": "OPEN", "id": "2313" } ], "lastTransactionID": "2315" }
-