Oanda FX Rates
What is this endpoint for?
The OANDA FX Rates endpoint provides auditable, reliable, and IFRS-compliant FX rates for over 70 forex pairs.
HTTP Request
https://us.market-api.kaiko.io/v2/data/analytics.{data_version}/oanda_fx_rates
Parameters
Fields
Request examples
curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
'https://us.market-api.kaiko.io/v2/data/analytics.v2/oanda_fx_rates?base=eur&page_size=2&sort=desc&interval=1d"e=jpy'
import http.client
import json
# Enter your Kaiko API Key
api_key = "KAIKO_API_KEY"
api_host = "us.market-api.kaiko.io"
api_base_endpoint = "/v2/data/analytics.v2/oanda_fx_rates"
# Start of mandatory parameter configuration
mandatory_params = {
"base": "eur",
"quote": "jpy",
"start_time" : "2024-09-27T13:13:53.441Z",
"end_time" : "2024-09-27T13:27:53.441Z",
}
# End of mandatory parameter configuration
# Start of optional parameter configuration
optional_params = {
"interval": "1m",
"sort": "desc"
}
# End of optional parameter configuration
conn = http.client.HTTPSConnection(api_host)
headers = {
"X-Api-Key": api_key,
"Accept": "application/json"
}
all_params = {**mandatory_params, **optional_params}
url_params = []
for param, value in all_params.items():
url_params.append(f"{param}={value}")
url_params = '&'.join(url_params)
# Initial request
endpoint_with_params = f"{api_base_endpoint}?{url_params}"
# Pagination for next pages
all_data = []
next_url = endpoint_with_params
while next_url:
conn.request("GET", next_url, headers=headers)
response = conn.getresponse()
data = json.loads(response.read().decode("utf-8"))
all_data.extend(data.get("data", []))
print(f"Fetched {len(data.get('data', []))} datapoints. Total: {len(all_data)}")
next_url = data.get("next_url", "").replace("https://us.market-api.kaiko.io", "")
if not next_url:
break
conn.close()
print(f" datapoints fetched: {(all_data)}")
Response example
{
"query": {
"base": "eur",
"quote": "jpy",
"interval": "1d",
"page_size": "2",
"sort": "desc",
"start_time": "null",
"end_time": "2022-08-31T08:38:25.883Z"
},
"time": "2022-08-31T08:38:25.905Z",
"timestamp": 1661935105,
"data": [
{
"timestamp": 1660780800000,
"fx_rate": "137.38630485436903"
},
{
"timestamp": 1660694400000,
"fx_rate": "137.15155641205303"
}
],
"continuation_token": "4tvMKJPYA6ESWsE7s87P2ujFvr6XRNvegzst2eg1EpdyQEPKWpuNic5XPGrhz47RzbbqC598E3XusLo34Hivgw4sYrrvdmYxL7WQVtebjtYVMUPPd97vqo2VjL22A6cTSNojTQsvHh8T6MPRjuJAMfx5LWyVZQWYyzLrSE",
"next_url": "https://us.market-api.kaiko.io/v2/data/analytics.v2/oanda_fx_rates?continuation_token=4tvMKJPYA6ESWsE7s87P2ujFvr6XRNvegzst2eg1EpdyQEPKWpuNic5XPGrhz47RzbbqC598E3XusLo34Hivgw4sYrrvdmYxL7WQVtebjtYVMUPPd97vqo2VjL22A6cTSNojTQsvHh8T6MPRjuJAMfx5LWyVZQWYyzLrSE"
}
Last updated