Historical Price Data
Branch Feed REST API
17
th
Oct 2024
Introduction
This document provides the API specification and guidance for using the SGX FX Historical
Price Data REST API.
The SGX FX Historical Price system collects and stores pricing data for a defined set of
instruments. The system continually collects the price feed from liquidity providers - even if no
users are signed in.
Legal Notices
This document and all portions thereof are the exclusive property of SGX FX Systems UK
Limited (“SGX-FX”). This document is protected by copyright law and international treaties.
Unauthorized possession, reproduction, duplication, or dissemination of this document, or any
portion of it, is illegal and may result in severe civil and criminal penalties. Prosecution will be
to the maximum extent possible under the law.
All SGX-FX computer programs and all SGX-FX source code are the exclusive property
of SGX-FX. All such programs, regardless of distributed form, are protected by copyright law
and international treaties. Unauthorized reproduction of such programs and/or code, or any
portions thereof, may result in severe civil and criminal penalties, and will be prosecuted to the
maximum extent possible under the law.
This document is provided “as is”, without warranty of any kind, either express or implied,
including, but not limited to, the implied warranties of merchantability, fitness for a particular
purpose, or non-infringement. Information in this document is subject to change without notice.
Technical updates are periodically added to the information herein. SGX-FX may make
improvements and/or changes to the product(s) and/or the program(s) described in this
publication at any time.
Companies, names, and data used in examples herein are fictitious unless otherwise noted. No
part of this document may be reproduced or transmitted in any form or by any means, electronic
or mechanical, for any purpose, without the express written permission of SGX-FX.
REST
Access to Historical Data is via HTTP REST calls.
All requests must use HTTPS. Authorization uses BASIC auth.
Responses are in JSON format.
Requests can result in large responses. To reduce the number of bytes returned, we encourage the
use of compression. This can be done by using the Accept-Encoding: gzip header.
URL
The base URL for querying pricing data collected for your branch is
https://data.app.bidfx.com/api/price/historical/v1/private/fx/
*The UAT environment can be accessed at data.app.bidfx.biz
Finding out what's available
To find out what instruments are available at a given time, you can send a probe request.
Request
Path
GET https://data.app.bidfx.com/api/price/historical/v1/private/fx/probe
Query Parameters
Parameter Description Mandatory Example
start_time
The start time at which to query available
data.
yyyyMMddHHmmss
One of either:
start_time &
end_time OR
start_utime &
end_utime
20190106113500
start_utime
The unix time at which to query available
data
-
epoch seconds
1578408047
end_time
The time at which to query available data
yyyyMMddHHmmss
default = start_time
20190106113500
end_utime
The unix time at which to query available
data - epoch seconds
1578408047
currency_pair
The currency pair to query
EURUSD
currency
The dealt currency to query
EUR
deal_type
The deal type to query
Can be one of SPOT, FORWARD, NDF
FORWARD
quantity
The quantity to query
1000000
tenor
The tenor to query. For deal_type=SPOT
can be omitted or must be SPOT, otherwise
can be one of:
SN, TOD, TOM,
1W, 2W, 3W,
1M, 2M, 3M, 4M, 5M, 6M, 7M, 8M, 9M,
10M, 11M,
1Y, 2Y, 3Y,
IMMH, IMMM, IMMU, IMMZ,
IMMH1, IMMM1, IMMU1, IMMZ1,
BJAN, EMAR, BAPR, EJUN, BJUL, ESEP,
BOCT, EDEC,
BJAN1, EMAR1, BAPR1, EJUN1, BJUL1,
ESEP1, BOCT1, EDEC1,
BMFF, BMFG, BMFH, BMFJ, BMFK,
BMFM, BMFN, BMFQ, BMFU, BMFV,
BMFX, BMFZ (tenors starting from BMF
are for USDBRL only)
6M
Response
Component
Type Contents
root Object
{
"instruments": [<Instrument>]
}
Instrument Object
{
"currency_pair": String,
"currency": String,
"deal_type": String,
"tenor": String,
"quantity": String
}
Example
Request
GET
https://data.app.bidfx.com/api/price/historical/v1/private/fx/probe?start_tim
e=20200609115332&end_time=20200616125332
Response:
{
"instruments": [
{
"currency_pair": "EURUSD",
"currency": "EUR",
"deal_type": "SPOT",
"tenor": "SPOT",
"quantity": "1000000"
},
{
"currency_pair": "USDINR",
"currency": "USD",
"deal_type": "NDF",
"tenor": "1M",
"quantity": "1000000"
},
{
"currency_pair": "EURUSD",
"currency": "EUR",
"deal_type": "FORWARD",
"tenor": "1M",
"quantity": "1000000"
}
]
}
Querying Data in JSON format
Request
When querying data, the instrument must be specified using query parameters. The time range
can be specified using a variety of methods - including start and end times, a start time and
duration, or a whole trade date.
If the returned set of data is particularly large, the server may decide to only return the start of
the set. If this occurs, a Paging object will be included in the response, that provides the path to
the next page.
Path
GET https://data.app.bidfx.com/api/price/historical/v1/private/fx
Query Parameters
Parameter Description Mandatory Example
currency_pair
6
-
character symbol
EURGBP
currency
3-character symbol
If excluded, assumes base currency
EUR
deal_type
The deal type to query.
Can be one of SPOT, FORWARD,
NDF
SPOT
quantity
Numeric values. (fractional part is
optional)
1000000
tenor
The tenor to query. For
deal_type=SPOT can be omitted or
must be SPOT, otherwise can be one
of:
SN, TOD, TOM,
1W, 2W, 3W,
1M, 2M, 3M, 4M, 5M, 6M, 7M, 8M,
9M, 10M, 11M,
1Y, 2Y, 3Y,
IMMH, IMMM, IMMU, IMMZ,
IMMH1, IMMM1, IMMU1, IMMZ1,
BJAN, EMAR, BAPR, EJUN, BJUL,
ESEP, BOCT, EDEC,
BJAN1, EMAR1, BAPR1, EJUN1,
BJUL1, ESEP1, BOCT1, EDEC1,
BMFF, BMFG, BMFH, BMFJ,
BMFK, BMFM, BMFN, BMFQ,
BMFU, BMFV, BMFX, BMFZ
(tenors starting from BMF are for
USDBRL only)
required
if deal_type
!= SPOT
1M
resolution
minimum milliseconds between ticks
1000
trade_date
yyyyMMdd Data will be returned
from 10pm on the previous day (i.e.
20191220
Parameter Description Mandatory Example
when the dates roll) to 10pm on the
day. (Weekend/Holidays handled
slightly more complicatedly)
One of
either:
trade_date
OR
start_time &
end_time
OR
start_utime
& end_utime
OR
start_time &
duration OR
start_utime
& duration
start_time
yyyyMMddHHmmss A Gregorian-
based UTC timestamp for the start
time
20191220131000.000
start_utime
Seconds from the unix epoch. Unix
timestamp for the start time
1576847400.000
end_time
yyyyMMddHHmmss A Gregorian-
based UTC timestamp for the end
time
20191220132000.000
end_utime
Seconds from the unix epoch. Unix
timestamp for the end time
1576848000000.000
duration Number of seconds for data to return 600
meta
Boolean. Whether to return the
"meta" part of the response
Default=false
true
data
Boolean. Whether to return the "data"
part of the response
Default = true
false
timestamp_for
mat
How to format the timestamps of
ticks
Value Format
ISO8601
(default)
yyyy-MM-
dd"T"HH:mm:ss.SSS"Z"
unix s.SSS
Parameter Description Mandatory Example
java sSSS
Java Time -
millseconds since
unix epoch
e.g.
1578402321020
numeric
yyyyMMddHHmmss.SSS
Compact format
timezone
The timezone id at which to interpret
the start_time and end_time
parameters. Ignored for unix-based
timestamp parameters. Default =
UTC
Europe/London
Asia/Singapore
Pacific/Auckland
liquidity_prov
ider
The liquidity provider to filter by.
Filter multiple LPs by including
multiple liquidity_provider filters.
liquidity_provider=HSBC
liquidity_provider=HSBC
&liquidity_provider=DEUT
timezone
The timezone id at which to interpret
the start_time and end_time
Europe/London
Asia/Singapore
Pacific/Auckland
Response
Component
Type Contents
root Object
{
"data": [<Data>],
"meta": <Meta>,
"paging": <Paging>
}
Data Object
{
"bid_spot": String,
"ask_spot": String,
"liquidity_provider": String,
"timestamp": String,
"bid_forward_points": String,
"ask_forward_points": String
}
Meta Object
{
"start_time": String,
"tenor": String,
"currency_pair": String,
"quantity": String,
"settlement_date": String,
"deal_type": String,
"count": String,
"end_time": String,
"currency": String,
"trade_date": String,
"resolution": String
}
Paging Object
{
"next_page": String
}
*bid_forward_points and ask_forward_points will only be present on FORWARD and NDF deal
types.
Example
Request
GET https://data.app.bidfx.com/api/price/historical/v1/private/fx?tenor=SPOT&currency_pair=E
URUSD&quantity=1000000&data=true&deal_type=SPOT&trade_date=20200615&currency=E
UR&resolution=30000&meta=true
Response
{
"meta": {
"start_time": "2020-06-12T21:00:00.000Z",
"tenor": "SPOT",
"currency_pair": "EURUSD",
"quantity": "1000000.00",
"settlement_date": "20200616",
"deal_type": "SPOT",
"count": "16200",
"end_time": "2020-06-14T00:00:00.000Z",
"currency": "EUR",
"trade_date": "20200612",
"resolution": "30000"
},
"data": [
{
"bid_spot": "1.104840",
"liquidity_provider": "CITI",
"ask_spot": "1.106835",
"timestamp": "2020-06-12T21:00:00.000Z"
},
{
"bid_spot": "1.105091",
"liquidity_provider": "ANZX",
"ask_spot": "1.106562",
"timestamp": "2020-06-12T21:00:00.000Z"
}
],
"paging": {
"next_page": "/api/price/historical/v1/private/fx?currency_pair=EURUS
D&deal_type=SPOT&quantity=1000000&tenor=SPOT&resolution=30000&meta=true&data=
true&start_time=20200614000000.000&end_time=20200615210000.000&timestamp_form
at=ISO8601"
}
}