Historical Price Data
Consolidated Feed REST API
17
th
Oct 2024
Introduction
This document provides the API specification and guidance for using the BidFX Historical Price
Data REST API consolidated API.
The BidFX 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.
Pricing data can be accessed by using one of the two following methods:
a REST endpoint which takes start_time and end_time as parameters, and returns data 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.
a REST endpoint which takes a date as parameter and returns a list of links to gcloud to
download AVRO files directly from BidFX google cloud bucket. This method does not
require a GCP account as the links returned are pre-signed by BidFX service account.
For intraday access (near real-time) the REST/JSON endpoint should be used.
For accessing historical data on ad-hoc basis or for daily t-1 download the preferred method is
downloading AVRO files.
URL
The base URL for querying pricing data is
https://data.app.bidfx.com/api/price/historical/v1/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/fx/probe
Query Parameters
Parameter Description Mandatory
Example
start_time
The start time at
which to query
available data.
yyyyMMddHHmmss
One of
either: 20190106113500
start_utime
The unix time at
which to query
available data -
epoch seconds
start_time
& end_time
OR
start_utime
&
end_utime
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
default = start_utime
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/fx/probe?start_time=202006
09115332&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/fx
Query Parameters
Parameter Description Mandatory Example
currency_pair
6
-
character symbol
EURGBP
currency
3-character symbol
If excluded, assumes base currency
EUR
Parameter Description Mandatory Example
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.
when the dates roll) to 10pm on the
day. (Weekend/Holidays handled
slightly more complicatedly)
One of
either:
20191220
Parameter Description Mandatory Example
start_time
yyyyMMddHHmmss A Gregorian-
based UTC timestamp for the start
time
trade_date
OR
start_time &
end_time
OR
start_utime
& end_utime
OR
start_time &
duration OR
start_utime
& duration
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
Response
Component
Type Contents
root Object
{
"data": [<Data>],
"meta": <Meta>,
"paging": <Paging>
}
Data Object
{
"bid_spot": String,
"ask_spot": String,
"timestamp": String,
"bid_forward_points": String,
"ask_forward_points": String,
"confidence_level": 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.
"confidence_level" is a number between 0 and 5, referring to the number of quotes streams used
to calculate the price. If more than 5 quote streams were used, then 5 will be shown. Note: a
confidence level of less than five means there may have been more than the displayed number of
quote streams available to calculate from, but some were discarded for quality.
Example
Request
GET https://data.app.bidfx.com/api/price/historical/v1/fx?tenor=SPOT&currency_pair=EURUS
D&quantity=1000000&data=true&deal_type=SPOT&trade_date=20200615&currency=EUR&re
solution=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",
"ask_spot": "1.106835",
"timestamp": "2020-06-12T21:00:00.000Z",
"confidence_level": "2"
},
{
"bid_spot": "1.105091",
"ask_spot": "1.106562",
"timestamp": "2020-06-12T21:00:00.000Z",
"confidence_level": "2"
}
],
"paging": {
"next_page": "/api/price/historical/v1/fx?currency_pair=EURUSD&deal_t
ype=SPOT&quantity=1000000&tenor=SPOT&resolution=30000&meta=true&data=true&sta
rt_time=20200614000000.000&end_time=20200615210000.000&timestamp_format=ISO86
01"
}
}
Querying Data in AVRO format
Request
When querying data, the instrument must be specified using query parameters. The time range
must be as a whole trade date.
Path
GET https://data.app.bidfx.com/api/price/historical/v1/fx/files
Query Parameters
Parameter Description Mandatory Example
date
calendar date in YYYY-MM-DD format,
e.g.
2023-09-06
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,
required
if deal_type !=
SPOT
1M
Parameter Description Mandatory Example
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 (for USDBRL only
)
Response
Component
Type Contents
root Object
{
"data":{
"links": [
"https://link-to-file1",
"https://link-to-file2"
]
}
}
Each response usually contains 24 links to download files from GCP bucket directly, where each
file contains prices for the requested instrument for 1 hour.
Downloading files does not require GCP account, as the links returned are pre-signed by BidFX
service account.
AVRO file schema
Avro files are compressed using zstandard avro encoding.
Field Type
Contents Example
time long
Unix timestamp in milliseconds, example:
1598518807000
1598518807000
bid_spot
string
0.907655
ask_spot
string
0.907705
bid_forward_points
string
will only be present on FORWARD and NDF
deal types
-0.001552
ask_forward_points
string
will only be present on FORWARD and NDF
deal types
-0.001537