PricingInfo

class oandapyV20.endpoints.pricing.PricingInfo(accountID, params=None)

Bases: oandapyV20.endpoints.pricing.Pricing

Pricing.

Get pricing information for a specified list of Instruments within an account.

ENDPOINT = 'v3/accounts/{accountID}/pricing'
EXPECTED_STATUS = 200
METHOD = 'GET'
__init__(accountID, params=None)

Instantiate a PricingStream APIRequest instance.

Parameters:
  • accountID (string (required)) – the accountID of the account.
  • params (dict (required)) – parameters for the request, check developer.oanda.com for details.

Example

>>> import oandapyV20
>>> from oandapyV20 import API
>>> import oandapyV20.endpoints.pricing as pricing
>>> accountID = "..."
>>> api = API(access_token="...")
>>> params =
        {
          "instruments": "EUR_USD,EUR_JPY"
        }
>>> r = pricing.PricingInfo(accountID=accountID, params=params)
>>> rv = api.request(r)
>>> print r.response

Output:

{
  "prices": [
    {
      "status": "tradeable",
      "instrument": "EUR_USD",
      "quoteHomeConversionFactors": {
        "negativeUnits": "0.89160730",
        "positiveUnits": "0.89150397"
      },
      "asks": [
        {
          "price": "1.12170",
          "liquidity": 10000000
        },
        {
          "price": "1.12172",
          "liquidity": 10000000
        }
      ],
      "time": "2016-10-05T05:28:16.729643492Z",
      "closeoutAsk": "1.12174",
      "bids": [
        {
          "price": "1.12157",
          "liquidity": 10000000
        },
        {
          "price": "1.12155",
          "liquidity": 10000000
        }
      ],
      "closeoutBid": "1.12153",
      "unitsAvailable": {
        "default": {
          "short": "506246",
          "long": "506128"
        },
        "reduceOnly": {
          "short": "0",
          "long": "0"
        },
        "openOnly": {
          "short": "506246",
          "long": "506128"
        },
        "reduceFirst": {
          "short": "506246",
          "long": "506128"
        }
      }
    },
    {
      "status": "tradeable",
      "instrument": "EUR_JPY",
      "quoteHomeConversionFactors": {
        "negativeUnits": "0.00867085",
        "positiveUnits": "0.00866957"
      },
      "asks": [
        {
          "price": "115.346",
          "liquidity": 1000000
        },
        {
          "price": "115.347",
          "liquidity": 2000000
        },
        {
          "price": "115.348",
          "liquidity": 5000000
        },
        {
          "price": "115.350",
          "liquidity": 10000000
        }
      ],
      "time": "2016-10-05T05:28:15.621238671Z",
      "closeoutAsk": "115.350",
      "bids": [
        {
          "price": "115.329",
          "liquidity": 1000000
        },
        {
          "price": "115.328",
          "liquidity": 2000000
        },
        {
          "price": "115.327",
          "liquidity": 5000000
        },
        {
          "price": "115.325",
          "liquidity": 10000000
        }
      ],
      "closeoutBid": "115.325",
      "unitsAvailable": {
        "default": {
          "short": "506262",
          "long": "506112"
        },
        "reduceOnly": {
          "short": "0",
          "long": "0"
        },
        "openOnly": {
          "short": "506262",
          "long": "506112"
        },
        "reduceFirst": {
          "short": "506262",
          "long": "506112"
        }
      }
    }
  ]
}