Single-asset benchmarks that 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.
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
Field
Description
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.
# This is a code example. Configure your parameters in the parameter configuration section #from__future__import print_functionimport loggingimport osimport grpcfrom google.protobuf.json_format import MessageToJsonfrom google.protobuf import duration_pb2from kaikosdk import sdk_pb2_grpcfrom kaikosdk.core import instrument_criteria_pb2, assets_pb2from kaikosdk.stream.aggregates_ohlcv_v1 import request_pb2 as pb_ohlcvfrom kaikosdk.stream.aggregates_vwap_v1 import request_pb2 as pb_vwapfrom kaikosdk.stream.market_update_v1 import request_pb2 as pb_market_updatefrom kaikosdk.stream.market_update_v1 import commodity_pb2 as pb_commodityfrom kaikosdk.stream.trades_v1 import request_pb2 as pb_tradesfrom kaikosdk.stream.index_v1 import request_pb2 as pb_indexfrom kaikosdk.stream.index_multi_assets_v1 import request_pb2 as pb_index_multi_assetsfrom kaikosdk.stream.index_forex_rate_v1 import request_pb2 as pb_index_forex_ratefrom kaikosdk.stream.aggregated_quote_v2 import request_pb2 as pb_aggregated_quotefrom kaikosdk.stream.aggregates_spot_exchange_rate_v2 import request_pb2 as pb_spot_exchange_ratefrom kaikosdk.stream.aggregates_direct_exchange_rate_v2 import request_pb2 as pb_direct_exchange_ratedefindex_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())defrun(): 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()
This example demonstrates how to request historical data using replay. The maximum amount of data you can request for one replay cannot exceed a total of 24 hours in hours, seconds, and minutes.
Replay data is available on a 72-hour rolling basis and should only be used to retrieve missed data. If full history is required, please use Rest API or CSV deployment methods.
# This is a code example. Configure your parameters below #from__future__import print_functionimport loggingimport osimport datetimeimport grpcfrom google.protobuf.json_format import MessageToJsonfrom kaikosdk import sdk_pb2_grpcfrom kaikosdk.stream.index_v1 import request_pb2 as pb_indexfrom google.protobuf.timestamp_pb2 import Timestampapi_key = os.environ.get('KAIKO_API_KEY')defindex_request(channel: grpc.Channel,index_code,start_unix,end_unix): k = []try:with channel: stub = sdk_pb2_grpc.StreamIndexServiceV1Stub(channel) responses = stub.Subscribe(pb_index.StreamIndexServiceRequestV1( index_code=index_code, interval={'start_time': Timestamp(seconds=start_unix),'end_time': Timestamp(seconds=end_unix) } ))if os.path.exists('index_replay_logging.txt'): os.remove('index_replay_logging.txt')print("index_replay_logging.txt Removed!")for response in responses:# print("Received message %s" % (MessageToJson(response, including_default_value_fields=True))) k += [eval(MessageToJson(response))]except grpc.RpcError as e:print(e.details(), e.code())print("replay is done!")return kdefrun(start_time,end_time,index_list): credentials = grpc.ssl_channel_credentials(root_certificates=None) call_credentials = grpc.access_token_call_credentials(api_key) composite_credentials = grpc.composite_channel_credentials(credentials, call_credentials) channel = grpc.secure_channel('gateway-v0-grpc.kaiko.ovh', composite_credentials) res =index_request(channel=channel, index_code=','.join(index_list), start_unix=start_time, end_unix=end_time)# print(res)return resif__name__=='__main__': logging.basicConfig() current_time = datetime.datetime.now() current_time = current_time.replace(second=0, microsecond=0)# start of time configuration # start_time = current_time - datetime.timedelta(minutes=15) end_time = current_time - datetime.timedelta(minutes=5)# start of time configuration # start_time =int(start_time.timestamp()) end_time =int(end_time.timestamp())# add your index code(s) # res =run(start_time=start_time, end_time=end_time, index_list = ['KK_BRR_BTCUSD'])print(res)
cURL requests are intended for testing purposes only.