OANDA Pricing API
The Pricing API from OANDA — 2 operation(s) for pricing.
The Pricing API from OANDA — 2 operation(s) for pricing.
swagger: '2.0'
info:
title: OANDA v20 REST Accounts Pricing API
description: The full OANDA v20 REST API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
contact:
name: OANDA API Support
url: http://developer.oanda.com/rest-live-v20/introduction/
email: api@oanda.com
license:
name: MIT
url: https://github.com/oanda/v20-openapi/blob/master/LICENSE.txt
version: 3.0.25
basePath: /v3
schemes:
- https
consumes:
- application/json
produces:
- application/json
tags:
- name: Pricing
paths:
/pricing:
get:
summary: Get Base Prices
description: Get pricing information for a specified instrument. Accounts are not associated in any way with this endpoint.
operationId: getBasePrices
parameters:
- $ref: '#/parameters/authorizationHeaderParam'
- $ref: '#/parameters/acceptDatetimeFormatHeaderParam'
- name: time
description: The time at which the desired price for each instrument is in effect. The current price for each instrument is returned if no time is provided.
in: query
type: string
format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
responses:
'200':
description: Pricing information has been successfully provided.
headers:
RequestID:
description: The unique identifier generated for the request
type: string
schema:
type: object
properties:
prices:
type: array
description: The list of prices that satisfy the request.
items:
$ref: '#/definitions/Price'
'400':
$ref: '#/responses/400'
'401':
$ref: '#/responses/401'
'404':
$ref: '#/responses/404'
'405':
$ref: '#/responses/405'
tags:
- Pricing
/pricing/range:
get:
summary: Get Price Range
description: Get pricing information for a specified range of prices. Accounts are not associated in any way with this endpoint.
operationId: getPriceRange
parameters:
- $ref: '#/parameters/authorizationHeaderParam'
- $ref: '#/parameters/acceptDatetimeFormatHeaderParam'
- $ref: '#/parameters/instrumentNamePathParam'
- name: from
description: The start of the time range to fetch prices for.
in: query
type: string
format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
required: true
- name: to
description: The end of the time range to fetch prices for. The current time is used if this parameter is not provided.
in: query
type: string
format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
responses:
'200':
description: Pricing information has been successfully provided.
headers:
RequestID:
description: The unique identifier generated for the request
type: string
Link:
description: A link to the next page of results if the results were paginated
type: string
schema:
type: object
properties:
prices:
type: array
description: The list of prices that satisfy the request.
items:
$ref: '#/definitions/Price'
'400':
$ref: '#/responses/400'
'401':
$ref: '#/responses/401'
'404':
$ref: '#/responses/404'
'405':
$ref: '#/responses/405'
tags:
- Pricing
definitions:
PriceBucket:
type: object
description: A Price Bucket represents a price available for an amount of liquidity
properties:
price:
type: string
description: The Price offered by the PriceBucket
format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.
liquidity:
type: integer
description: The amount of liquidity offered by the PriceBucket
Price:
type: object
description: The Price representation
properties:
instrument:
type: string
description: The Price's Instrument.
format: A string containing the base currency and quote currency delimited by a "_".
tradeable:
type: boolean
description: Flag indicating if the Price is tradeable or not
timestamp:
type: string
description: The date/time when the Price was created.
format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
baseBid:
type: string
description: The base bid price as calculated by pricing.
format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.
baseAsk:
type: string
description: The base ask price as calculated by pricing.
format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.
bids:
type: array
description: The list of prices and liquidity available on the Instrument's bid side. It is possible for this list to be empty if there is no bid liquidity currently available for the Instrument in the Account.
items:
$ref: '#/definitions/PriceBucket'
asks:
type: array
description: The list of prices and liquidity available on the Instrument's ask side. It is possible for this list to be empty if there is no ask liquidity currently available for the Instrument in the Account.
items:
$ref: '#/definitions/PriceBucket'
closeoutBid:
type: string
description: The closeout bid price. This price is used when a bid is required to closeout a Position (margin closeout or manual) yet there is no bid liquidity. The closeout bid is never used to open a new position.
format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.
closeoutAsk:
type: string
description: The closeout ask price. This price is used when an ask is required to closeout a Position (margin closeout or manual) yet there is no ask liquidity. The closeout ask is never used to open a new position.
format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.
parameters:
instrumentNamePathParam:
name: instrument
description: Name of the Instrument
in: path
type: string
format: A string containing the base currency and quote currency delimited by a "_".
required: true
acceptDatetimeFormatHeaderParam:
name: Accept-Datetime-Format
description: Format of DateTime fields in the request and response.
in: header
type: string
authorizationHeaderParam:
name: Authorization
description: The authorization bearer token previously obtained by the client
in: header
type: string
format: The string 'Bearer ' followed by the token.
required: true
responses:
'400':
description: Bad Request. The client has provided invalid data to be processed by the server.
headers:
RequestID:
description: The unique identifier generated for the request
type: string
schema:
type: object
properties:
errorCode:
type: string
description: The code of the error that has occurred. This field may not be returned for some errors.
errorMessage:
type: string
description: The human-readable description of the error that has occurred.
'404':
description: Not Found. The client has attempted to access an entity that does not exist.
headers:
RequestID:
description: The unique identifier generated for the request
type: string
schema:
type: object
properties:
errorCode:
type: string
description: The code of the error that has occurred. This field may not be returned for some errors.
errorMessage:
type: string
description: The human-readable description of the error that has occurred.
'405':
description: Method Not Allowed. The client has attempted to access an endpoint using an HTTP method that is not supported.
headers:
RequestID:
description: The unique identifier generated for the request
type: string
schema:
type: object
properties:
errorCode:
type: string
description: The code of the error that has occurred. This field may not be returned for some errors.
errorMessage:
type: string
description: The human-readable description of the error that has occurred.
'401':
description: Unauthorized. The endpoint being access required the client to authenticated, however the the authentication token is invalid or has not been provided.
headers:
RequestID:
description: The unique identifier generated for the request
type: string
schema:
type: object
properties:
errorCode:
type: string
description: The code of the error that has occurred. This field may not be returned for some errors.
errorMessage:
type: string
description: The human-readable description of the error that has occurred.