HistoricalPositionRatios

class oandapyV20.endpoints.forexlabs.HistoricalPositionRatios(params)

Bases: oandapyV20.endpoints.forexlabs.ForexLabs

HistoricalPositionRatios.

Get the historical positionratios for an instrument.

ENDPOINT = 'labs/v1/historical_position_ratios'
EXPECTED_STATUS = 200
METHOD = 'GET'
__init__(params)

Instantiate a HistoricalPositionRatios request.

Parameters:params (dict (required)) – query params to send, check developer.oanda.com for details.
>>> import oandapyV20
>>> import oandapyV20.endpoints.forexlabs as labs
>>> accountID = ...
>>> client = oandapyV20.API(access_token=...)
>>> params =
        {
          "instrument": "EUR_USD",
          "period": 86400
        }
>>> r = labs.HistoricalPositionRatios(params=params)
>>> client.request(r)
>>> print(r.response)

Output:

{
  "data": {
    "EUR_USD": {
      "data": [
        [
          1519924801,
          44.22,
          1.2209
        ],
        [
          1519926001,
          44.33,
          1.221
        ],
        [
          1519927200,
          44.16,
          1.2212
        ],
        [
          1519928400,
          44.2,
          1.2209
        ],
        [
          1519929601,
          43.88,
          1.2201
        ],
        [
          1519930800,
          44.15,
          1.2197
        ],
        [
          1519932000,
          44.51,
          1.2204
        ],
        [
          1519933200,
          44.55,
          1.2233
        ],
        [
          1519934401,
          44.55,
          1.2254
        ],
        [
          1519935601,
          44.08,
          1.226
        ],
        [
          1519936801,
          43.67,
          1.2264
        ],
        [
          1519938001,
          43.55,
          1.2263
        ],
        [
          1519939201,
          43.25,
          1.2261
        ],
        [
          1519940401,
          43.28,
          1.2263
        ],
        [
          1519941601,
          43.39,
          1.2267
        ],
        [
          1519942801,
          43.69,
          1.227
        ],
        [
          1519944001,
          43.57,
          1.2269
        ],
        [
          1519945201,
          43.68,
          1.2272
        ],
        [
          1519946400,
          43.51,
          1.2268
        ],
        [
          1519947601,
          43.53,
          1.2267
        ],
        [
          1519948801,
          43.71,
          1.2271
        ],
        [
          1519950001,
          43.66,
          1.2265
        ],
        [
          1519951201,
          43.78,
          1.2269
        ],
        [
          1519952401,
          43.86,
          1.2273
        ],
        [
          1519953600,
          43.85,
          1.2273
        ],
        [
          1519954800,
          43.81,
          1.2271
        ],
        [
          1519956001,
          44,
          1.2275
        ],
        [
          1519957200,
          43.89,
          1.2274
        ],
        [
          1519958401,
          43.95,
          1.2273
        ],
        [
          1519959601,
          43.93,
          1.2273
        ],
        [
          1519960800,
          43.86,
          1.2276
        ],
        [
          1519962000,
          44.02,
          1.2278
        ],
        [
          1519963200,
          44.18,
          1.228
        ],
        [
          1519964401,
          44.52,
          1.2283
        ],
        [
          1519965600,
          44.19,
          1.2281
        ],
        [
          1519966801,
          44.14,
          1.2278
        ],
        [
          1519968000,
          43.93,
          1.2276
        ],
        [
          1519969201,
          43.82,
          1.2277
        ],
        [
          1519970401,
          43.77,
          1.2279
        ],
        [
          1519971601,
          43.02,
          1.2269
        ],
        [
          1519972801,
          42.99,
          1.2265
        ],
        [
          1519974001,
          42.73,
          1.2263
        ],
        [
          1519975201,
          42.22,
          1.2262
        ],
        [
          1519976400,
          42.13,
          1.2255
        ],
        [
          1519977601,
          42.02,
          1.2263
        ],
        [
          1519978801,
          42.15,
          1.2261
        ],
        [
          1519980000,
          42.5,
          1.2273
        ],
        [
          1519981201,
          42.2,
          1.2274
        ],
        [
          1519982400,
          42.06,
          1.2271
        ],
        [
          1519983600,
          42.38,
          1.2279
        ],
        [
          1519984800,
          42.29,
          1.2276
        ],
        [
          1519986000,
          42.16,
          1.2281
        ],
        [
          1519987201,
          43.46,
          1.2291
        ],
        [
          1519988401,
          43.51,
          1.2291
        ],
        [
          1519989601,
          43.4,
          1.2317
        ],
        [
          1519990800,
          43.46,
          1.2317
        ],
        [
          1519992001,
          43.07,
          1.2304
        ],
        [
          1519993201,
          43.56,
          1.2316
        ],
        [
          1519994401,
          43.75,
          1.2319
        ],
        [
          1519995601,
          43.15,
          1.2308
        ],
        [
          1519996801,
          42.94,
          1.2309
        ],
        [
          1519998001,
          42.99,
          1.2315
        ],
        [
          1519999201,
          42.33,
          1.2309
        ],
        [
          1520000400,
          41.93,
          1.2299
        ],
        [
          1520001601,
          42.31,
          1.2303
        ],
        [
          1520002801,
          42.5,
          1.2313
        ],
        [
          1520004000,
          42.8,
          1.2326
        ],
        [
          1520005201,
          42.67,
          1.2317
        ],
        [
          1520006401,
          42.29,
          1.2309
        ],
        [
          1520007600,
          42.33,
          1.2309
        ],
        [
          1520008800,
          42.63,
          1.2321
        ],
        [
          1520010001,
          42.11,
          1.2314
        ]
      ],
      "label": "EUR/USD"
    }
  }
}