Benchmark Reference Rates

What is this endpoint for?

Our ready-to-go BMR-compliant rates for specific assets in the crypto market. Reference rates average the prices over a period of time to determine an average value and daily “close” prices (as crypto is 24/7, "close" prices are always synthetic). They can be used for several use cases from settlement of derivatives contracts to asset pricing and valuation. More information on the specific rates can be found here.

Endpoints

gateway-v0-grpc.kaiko.ovh

Parameters

ParameterDescriptionExamples

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.

Fields

FieldDescription

indexCode

The ticker identifying the rate.

commodity

The type of publication. Either real-time or fixings

interval

The time period in which transaction data are considered for the calculation of the rate. If a rate's calculation methodology has an interval of 15 seconds, startTime and endTime will be separated by 15s.

quote

The quote asset used for the rate denomination.

bases

The list of base assets included in the rate and their weight. For reference rates, this will always be a single asset.

exchanges

The exchanges involved in the computation. This list may change every quarter during the rebalancing period and depending on the new results of the Kaiko Exchange Ranking.

percentages

The different distribution levels included in the price computation.

price

The value of the rate in the quote denomination.

pairs

The list of pairs combined with additional details included in the computation.

tsEvent

The exact time of price publication.

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_rate_request(channel: grpc.Channel):
    try:
        with channel:
            stub = sdk_pb2_grpc.StreamIndexServiceV1Stub(channel)
            responses = stub.Subscribe(pb_index.StreamIndexServiceRequestV1(
                 # start of parameter configuration # 
                index_code = "KK_BRR_BTCUSD" 
                  # end of parameter configuration # 
            ))
            for response in responses:
                print("Received message %s" % (MessageToJson(response, including_default_value_fields = True)))
                # print("Received message %s" % list(map(lambda o: o.string_value, response.data.values)))
    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_rate_request(channel)

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

Response Example

{
  "indexCode": "KK_BRR_BTCUSD",
  "commodity": "SIC_REAL_TIME",
  "interval": {
    "startTime": "2024-08-12T13:48:45Z",
    "endTime": "2024-08-12T13:53:45Z"
  },
  "quote": "usd",
  "bases": [
    {
      "asset": "btc",
      "weight": 1.0
    }
  ],
  "exchanges": [
    "bfnx",
    "cbse",
    "krkn",
    "lmax",
    "stmp"
  ],
  "percentages": [
    {
      "percentage": 1.0,
      "price": 58461.761090909094,
      "pairs": [
        {
          "pair": "btc-usd",
          "weight": 1.0,
          "instruments": [
            {
              "partition": "0",
              "price": 58404.37,
              "volume": 24.361215079999987,
              "count": "545",
              "underlyingTrade": {
                "volume": 0.28,
                "exchange": "cbse",
                "id": "679495522",
                "datetime": "2024-08-12T13:48:48.227119Z"
              }
            },
            {
              "partition": "1",
              "price": 58447.35,
              "volume": 17.22527984999999,
              "count": "589",
              "underlyingTrade": {
                "volume": 0.33870923,
                "exchange": "cbse",
                "id": "679496144",
                "datetime": "2024-08-12T13:49:23.817896Z"
              }
            },
            {
              "partition": "2",
              "price": 58428.69,
              "volume": 10.035586310000001,
              "count": "419",
              "underlyingTrade": {
                "volume": 0.33303204,
                "exchange": "cbse",
                "id": "679496499",
                "datetime": "2024-08-12T13:49:45.100184Z"
              }
            },
            {
              "partition": "3",
              "price": 58464.3,
              "volume": 16.12647133000001,
              "count": "452",
              "underlyingTrade": {
                "volume": 0.125,
                "exchange": "cbse",
                "id": "679497072",
                "datetime": "2024-08-12T13:50:27.115087Z"
              }
            },
            {
              "partition": "6",
              "price": 58491.69,
              "volume": 19.274423530000025,
              "count": "477",
              "underlyingTrade": {
                "volume": 0.044,
                "exchange": "cbse",
                "id": "679498527",
                "datetime": "2024-08-12T13:52:03.221419Z"
              }
            },
            {
              "partition": "7",
              "price": 58424.9,
              "volume": 14.584170899999991,
              "count": "424",
              "underlyingTrade": {
                "volume": 0.3655928,
                "exchange": "cbse",
                "id": "679499080",
                "datetime": "2024-08-12T13:52:44.216425Z"
              }
            },
            {
              "partition": "8",
              "price": 58425.63,
              "volume": 6.909352779999999,
              "count": "305",
              "underlyingTrade": {
                "volume": 0.19652022,
                "exchange": "cbse",
                "id": "679499321",
                "datetime": "2024-08-12T13:53:09.097614Z"
              }
            },
            {
              "partition": "4",
              "price": 58507.6,
              "volume": 11.486490139999999,
              "count": "442",
              "underlyingTrade": {
                "volume": 0.11795193,
                "exchange": "cbse",
                "id": "679497509",
                "datetime": "2024-08-12T13:51:02.354315Z"
              }
            },
            {
              "partition": "5",
              "price": 58617.97,
              "volume": 22.758717719999996,
              "count": "612",
              "underlyingTrade": {
                "volume": 0.30000007,
                "exchange": "cbse",
                "id": "679498150",
                "datetime": "2024-08-12T13:51:40.171679Z"
              }
            },
            {
              "partition": "9",
              "price": 58403.7,
              "volume": 51.51317158000001,
              "count": "535",
              "underlyingTrade": {
                "volume": 4.52337977,
                "exchange": "krkn",
                "id": "72810698",
                "datetime": "2024-08-12T13:53:30.437555Z"
              }
            }
          ]
        }
      ]
    }
  ],
  "tsEvent": "2024-08-12T13:53:45.417622358Z",
  "sequenceId": "cqt17qfvavm6rm0ghh8g",
  "lastIngestTime": "2024-08-12T13:53:42.855990657Z"
}

Last updated