A nested object to configure following properties for your stream:
exchange (String) - The code(s) for the exchange(s)
instrument_class (String) - The class(es) of the instrument(s) . The instrument must be a derivative class.
code (String) - The Kaiko code for the instrument.
cbse
option
algo-btc
commodities
AlwaysSDICK_PRICE
SDICK_PRICE
Configuring a wildcard
A wildcard allows you to request all information we have on a specific instrument or exchange in the same stream.
Use a * in place of the relevant exchange or class parameter.
For example, the configuration below would deliver all perpetual future contracts on OkEX.
exchange: okex
class: perpetual-future
instrument: *
Fields
Field
Description
Example
value
The value for the commodity (price, 24 hour volume etc) received in the message.
The price of the underlying index, often as a weighted average across multiple exchanges' spot prices
index_price
The mark price of the contract. It is used for calculating profit and loss (PnL) and liquidation price. Designed to be fair and avoid price manipulation.
mark_price
Most recent traded price of derivative contract.
price
commodityKind
Always SDICK_PRICE
SDICK_PRICE
tsCollection
The timestamp for when Kaiko received the trade from the exchange.
2024-08-30T10:19:38.044166107Z
tsEvent
The timestamp for the interval.
2024-08-30T10:19:39.206955912Z
Request examples
# 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_ratefrom kaikosdk.stream.derivatives_instrument_metrics_v1 import request_pb2 as pb_derivatives_instrument_metricsfrom kaikosdk.stream.iv_svi_parameters_v1 import request_pb2 as pb_iv_svi_parametersdefderivatives_instrument_metrics_request(channel: grpc.Channel):try:with channel: stub = sdk_pb2_grpc.StreamDerivativesInstrumentMetricsServiceV1Stub(channel) responses = stub.Subscribe(pb_derivatives_instrument_metrics.StreamDerivativesInstrumentMetricsRequestV1( instrument_criteria = instrument_criteria_pb2.InstrumentCriteria(# Start of parameter configuration # exchange ="okex", instrument_class ="perpetual-future", code ="btc-usdt" ), commodities = ["SDICK_PRICE" ] ))# End of parameter configuration #for response in responses:print("Received message %s"% (MessageToJson(response, including_default_value_fields =True)))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)derivatives_instrument_metrics_request(channel)if__name__=='__main__': logging.basicConfig()run()``
cURL requests are intended for testing purposes only.