InstrumentsOrderBook¶
-
class
oandapyV20.endpoints.instruments.
InstrumentsOrderBook
(instrument, params=None)¶ Bases:
oandapyV20.endpoints.instruments.Instruments
Get orderbook data for a specified Instrument.
-
ENDPOINT
= 'v3/instruments/{instrument}/orderBook'¶
-
EXPECTED_STATUS
= 200¶
-
METHOD
= 'GET'¶
-
__init__
(instrument, params=None)¶ Instantiate an InstrumentsOrderBook request.
Parameters: - instrument (string (required)) – the instrument to fetch candle data for
- params (dict) – optional request query parameters, check developer.oanda.com for details
Params example:
{}
OrderBook data example:
>>> import oandapyV20 >>> import oandapyV20.endpoints.instruments as instruments >>> client = oandapyV20.API(access_token=...) >>> params = ... >>> r = instruments.InstrumentsOrderBook(instrument="EUR_USD", >>> params=params) >>> client.request(r) >>> print r.response
Output:
{ "orderBook": { "instrument": "EUR_USD", "buckets": [ { "price": "1.12850", "shortCountPercent": "0.2352", "longCountPercent": "0.2666" }, { "price": "1.12900", "shortCountPercent": "0.2195", "longCountPercent": "0.3293" }, { "price": "1.12950", "shortCountPercent": "0.3136", "longCountPercent": "0.2901" }, { "price": "1.13000", "shortCountPercent": "0.3842", "longCountPercent": "0.4156" }, { "price": "1.13050", "shortCountPercent": "0.1960", "longCountPercent": "0.3685" }, { "price": "1.13100", "shortCountPercent": "0.2431", "longCountPercent": "0.2901" }, { "price": "1.13150", "shortCountPercent": "0.2509", "longCountPercent": "0.3136" }, { "price": "1.13200", "shortCountPercent": "0.2587", "longCountPercent": "0.3450" }, { "price": "1.13250", "shortCountPercent": "0.3842", "longCountPercent": "0.2666" }, { "price": "1.13300", "shortCountPercent": "0.3371", "longCountPercent": "0.3371" }, { "price": "1.13350", "shortCountPercent": "0.3528", "longCountPercent": "0.2744" }, { "price": "1.13400", "shortCountPercent": "0.3842", "longCountPercent": "0.3136" }, { "price": "1.13450", "shortCountPercent": "0.2039", "longCountPercent": "0.2744" }, { "price": "1.13500", "shortCountPercent": "0.1882", "longCountPercent": "0.3371" }, { "price": "1.13550", "shortCountPercent": "0.0235", "longCountPercent": "0.0392" }, { "price": "1.13600", "shortCountPercent": "0.0549", "longCountPercent": "0.0314" }, { "price": "1.13650", "shortCountPercent": "0.1333", "longCountPercent": "0.0314" }, { "price": "1.13700", "shortCountPercent": "0.1176", "longCountPercent": "0.1019" }, { "price": "1.13750", "shortCountPercent": "0.1568", "longCountPercent": "0.0784" }, { "price": "1.13800", "shortCountPercent": "0.1176", "longCountPercent": "0.0862" }, { "price": "1.13850", "shortCountPercent": "0.2117", "longCountPercent": "0.1960" }, { "price": "1.13900", "shortCountPercent": "0.4548", "longCountPercent": "0.2587" }, { "price": "1.13950", "shortCountPercent": "0.2979", "longCountPercent": "0.3215" }, { "price": "1.14000", "shortCountPercent": "0.7449", "longCountPercent": "0.2901" }, { "price": "1.14050", "shortCountPercent": "0.2117", "longCountPercent": "0.1176" }, { "price": "1.14100", "shortCountPercent": "0.1960", "longCountPercent": "0.1333" }, { "price": "1.14150", "shortCountPercent": "0.1882", "longCountPercent": "0.1176" } ], "time": "2017-06-28T10:00:00Z", "price": "1.13609", "bucketWidth": "0.00050" } }
-