FOREX conversion

Convert your USD rate into a currency of your choosing.

What is this endpoint for?

This endpoint retrieves any single-asset Benchmark and converts USD into a local currency of your choosing using TP-ICAP as the source for the conversion. Currencies available are:

  • AUD

  • CHF

  • EUR

  • GBP

  • JPY

Endpoints

gateway-v0-grpc.kaiko.ovh

Request parameters

Parameter
Description
Examples

index_code

The Kaiko Benchmark Reference Rate ticker. You can find a full list of our tickers here.

KK_RR_BTCUS

Requesting multiple tickers at the same time To configure multiple tickers in the same stream, provide the indexCode as a comma separated list eg KK_PR_BTCUSD,KK_AAVE_USD Alternatively, use a wildcard by entering a * and you'll receive all tickers you have as part of you Kaiko subscription.

Response fields

Field
Description

indexCode

The ticker identifying the rate.

commodity

The type of publication. Either real-time or fixings

interval_startTime

The start time for the interval.

interval_endTime

The end time for the interval.

composition_underlying_name

The Kaiko Reference Rate Ticker.

composition_underlying_tsEvent

The exact time of original reference rate publication.

price

The price of the Reference Rate in the converted currency.

tsEvent

The exact time of converted reference rate publication.

detail_underlying_name

The ticker of the underlying reference rate.

detail_underlying_price

The original published price of the Reference Rate in USD.

detail_underlying_tsEvent

The exact timestamp of original reference rate publication.

fxrate_name

The name of the FOREX conversion rate we've sourced to convert USD into your chosen currency.

fxrate_price

The price of the FOREX conversion rate we've used to convert USD into your chosen currency.

fxrate_tsEvent

The timestamp for when we collected the FOREX conversion rate we've used to convert USD into your chosen currency.

Request examples

# This is a code example. Configure your parameters below #

from __future__ import print_function
from datetime import datetime, timedelta
import logging
import os
from google.protobuf.timestamp_pb2 import Timestamp
import grpc
from google.protobuf.json_format import MessageToJson
from kaikosdk import sdk_pb2_grpc
from kaikosdk.stream.index_forex_rate_v1 import request_pb2 as pb_index_forex_rate

def index_forex_rate(channel: grpc.Channel):
    try:
        with channel:
            stub = sdk_pb2_grpc.StreamIndexForexRateServiceV1Stub(channel)
            responses = stub.Subscribe(pb_index_forex_rate.StreamIndexForexRateServiceRequestV1(
                index_code = "KK_BRR_BTCUSD_EUR"
            ))
            for response in responses:
                # for debug purpose only, don't use MessageToJson in the reading loop in production
                print("Received message %s" % (MessageToJson(response, including_default_value_fields = True)))
    except grpc.RpcError as e:
        print(e.details(), e.code())

def run():
    credentials = grpc.ssl_channel_credentials(root_certificates=None)
    call_credentials = grpc.access_token_call_credentials(os.environ['KAIKO_API_KEY'])
    composite_credentials = grpc.composite_channel_credentials(credentials, call_credentials)
    channel = grpc.secure_channel('gateway-v0-grpc.kaiko.ovh', composite_credentials)
    index_forex_rate(channel)

if __name__ == '__main__':
    logging.basicConfig()
    run()

Response Example

{
  "indexCode": "KK_BRR_BTCUSD_EUR",
  "commodity": "SIC_REAL_TIME",
  "interval": {
    "startTime": "2024-09-12T21:42:35Z",
    "endTime": "2024-09-12T21:42:50Z"
  },
  "composition": {
    "underlying": {
      "name": "KK_BRR_BTCUSD",
      "tsEvent": "2024-09-12T21:42:50.658126160Z"
    },
    "fxrate": {
      "name": "USD/EUR",
      "tsEvent": "2024-09-12T21:42:01.048683287Z"
    }
  },
  "price": 52215.539302000085,
  "tsEvent": "2024-09-12T21:42:50.857862111Z",
  "detail": {
    "underlying": {
      "name": "KK_BRR_BTCUSD",
      "price": 57826.099,
      "tsEvent": "2024-09-12T21:42:50.658126160Z"
    },
    "fxrate": {
      "name": "USD/EUR",
      "price": 0.9029753036254458,
      "tsEvent": "2024-09-12T21:42:01.048683287Z"
    }
  }
}

Last updated

Was this helpful?