InstrumentsPositionBook

class oandapyV20.endpoints.instruments.InstrumentsPositionBook(instrument, params=None)

Bases: oandapyV20.endpoints.instruments.Instruments

Get positionbook data for a specified Instrument.

ENDPOINT = 'v3/instruments/{instrument}/positionBook'
EXPECTED_STATUS = 200
METHOD = 'GET'
__init__(instrument, params=None)

Instantiate an InstrumentsPositionBook 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:

{}

PositionBook data example:

>>> import oandapyV20
>>> import oandapyV20.endpoints.instruments as instruments
>>> client = oandapyV20.API(access_token=...)
>>> params = ...
>>> r = instruments.InstrumentsPositionBook(instrument="EUR_USD",
>>>                                         params=params)
>>> client.request(r)
>>> print r.response

Output:

{
  "positionBook": {
    "instrument": "EUR_USD",
    "buckets": [
      {
        "price": "1.12800",
        "shortCountPercent": "0.2670",
        "longCountPercent": "0.2627"
      },
      {
        "price": "1.12850",
        "shortCountPercent": "0.2034",
        "longCountPercent": "0.2712"
      },
      {
        "price": "1.12900",
        "shortCountPercent": "0.2034",
        "longCountPercent": "0.2161"
      },
      {
        "price": "1.12950",
        "shortCountPercent": "0.2670",
        "longCountPercent": "0.2839"
      },
      {
        "price": "1.13000",
        "shortCountPercent": "0.2755",
        "longCountPercent": "0.3221"
      },
      {
        "price": "1.13050",
        "shortCountPercent": "0.1949",
        "longCountPercent": "0.2839"
      },
      {
        "price": "1.13100",
        "shortCountPercent": "0.2288",
        "longCountPercent": "0.2712"
      },
      {
        "price": "1.13150",
        "shortCountPercent": "0.2416",
        "longCountPercent": "0.2712"
      },
      {
        "price": "1.13200",
        "shortCountPercent": "0.2204",
        "longCountPercent": "0.3178"
      },
      {
        "price": "1.13250",
        "shortCountPercent": "0.2543",
        "longCountPercent": "0.2458"
      },
      {
        "price": "1.13300",
        "shortCountPercent": "0.2839",
        "longCountPercent": "0.2585"
      },
      {
        "price": "1.13350",
        "shortCountPercent": "0.3602",
        "longCountPercent": "0.3094"
      },
      {
        "price": "1.13400",
        "shortCountPercent": "0.2882",
        "longCountPercent": "0.3560"
      },
      {
        "price": "1.13450",
        "shortCountPercent": "0.2500",
        "longCountPercent": "0.3009"
      },
      {
        "price": "1.13500",
        "shortCountPercent": "0.1738",
        "longCountPercent": "0.3475"
      },
      {
        "price": "1.13550",
        "shortCountPercent": "0.2119",
        "longCountPercent": "0.2797"
      },
      {
        "price": "1.13600",
        "shortCountPercent": "0.1483",
        "longCountPercent": "0.3094"
      },
      {
        "price": "1.13650",
        "shortCountPercent": "0.1483",
        "longCountPercent": "0.1314"
      },
      {
        "price": "1.13700",
        "shortCountPercent": "0.1568",
        "longCountPercent": "0.2034"
      },
      {
        "price": "1.13750",
        "shortCountPercent": "0.1398",
        "longCountPercent": "0.1271"
      },
      {
        "price": "1.13800",
        "shortCountPercent": "0.1314",
        "longCountPercent": "0.2034"
      },
      {
        "price": "1.13850",
        "shortCountPercent": "0.1483",
        "longCountPercent": "0.1695"
      },
      {
        "price": "1.13900",
        "shortCountPercent": "0.2924",
        "longCountPercent": "0.1653"
      },
      {
        "price": "1.13950",
        "shortCountPercent": "0.1526",
        "longCountPercent": "0.1865"
      },
      {
        "price": "1.14000",
        "shortCountPercent": "0.4365",
        "longCountPercent": "0.2034"
      },
      {
        "price": "1.14050",
        "shortCountPercent": "0.1398",
        "longCountPercent": "0.1144"
      }
    ],
    "time": "2017-06-28T10:00:00Z",
    "price": "1.13609",
    "bucketWidth": "0.00050"
  }
}