FOREX Converted Reference Rates

What is this endpoint for?

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

  • AUD

  • CHF

  • EUR

  • GBP

  • JPY

Endpoints

gateway-v0-grpc.kaiko.ovh

Parameters

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.

Fields

Request examples

Make sure to read our Python quick-start guide before starting.

 # This is a code example. Configure your parameters in the parameter configuration section #

from __future__ import print_function
import logging
import os

import grpc
from google.protobuf.json_format import MessageToJson
from google.protobuf import duration_pb2

from kaikosdk import sdk_pb2_grpc
from kaikosdk.core import instrument_criteria_pb2, assets_pb2
from kaikosdk.stream.aggregates_ohlcv_v1 import request_pb2 as pb_ohlcv
from kaikosdk.stream.aggregates_vwap_v1 import request_pb2 as pb_vwap
from kaikosdk.stream.market_update_v1 import request_pb2 as pb_market_update
from kaikosdk.stream.market_update_v1 import commodity_pb2 as pb_commodity
from kaikosdk.stream.trades_v1 import request_pb2 as pb_trades
from kaikosdk.stream.index_v1 import request_pb2 as pb_index
from kaikosdk.stream.index_multi_assets_v1 import request_pb2 as pb_index_multi_assets
from kaikosdk.stream.index_forex_rate_v1 import request_pb2 as pb_index_forex_rate
from kaikosdk.stream.aggregated_quote_v2 import request_pb2 as pb_aggregated_quote
from kaikosdk.stream.aggregates_spot_exchange_rate_v2 import request_pb2 as pb_spot_exchange_rate
from kaikosdk.stream.aggregates_direct_exchange_rate_v2 import request_pb2 as pb_direct_exchange_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(
                  # start of parameter configuration # 
                index_code = "KK_BRR_BTCUSD_EUR"
                  # end of parameter configuration # 
            ))
            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