For information on changes for our US clients, please visit our Support Center article.

Devido à crescente demanda, a verificação da conta poderá demorar. Evite enviar várias solicitações, e para melhores resultados, veja nossos Requisitos de documentação em primeiro lugar.
Buscar
WebSocket API v1 - Market data feed example
The WebSocket API v1 market data feeds are a series of public (unauthenticated) feeds, that provide a real time stream of the available trading data (ticker, time and sales, order book, etc.) for our markets.
As live market data streams, any changes to the market data (such as updates to the best bid/ask prices or volumes, for example) would cause an update message to be sent via one or more of the market data feeds.

How to subscribe to a market data feed

Once a connection to the WebSocket API v1 has been established (using the public URL wss://ws.kraken.com/), the market data feeds can be subscribed to by sending a subscription message like the following:
  • {"event":"subscribe", "subscription":{"name":"ticker"}, "pair":["BTC/USD"]}
Upon receipt of a valid subscription request, the market data feeds would send a subscription confirmation message:
  • {"channelID":324,"channelName":"ticker","event":"subscriptionStatus","pair":"XBT/USD","status":"subscribed","subscription":{"name":"ticker"}}
followed by an initial market data snapshot (depending upon the feed in question), and then the live stream of the real time market data.

Example live stream from a market data feed

The following is an example of the ticker feed, illustrating the type of messages that are received for various market data changes (such as trade occurring causing the best bid/ask volume to change):
[324,{"a":["42243.20000",3,"3.04172624"],"b":["42243.10000",0,"0.28500000"],"c":["42243.20000","0.00073657"],"v":["634.15053067","2117.90194729"],"p":["41908.86644","41673.47236"],"t":[7214,21130],"l":["40772.20000","40772.20000"],"h":["42474.30000","42571.50000"],"o":["41016.00000","41896.10000"]},"ticker","XBT/USD"]
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
[324,{"a":["42243.20000",0,"0.01460168"],"b":["42243.10000",3,"3.82293519"],"c":["42243.20000","0.01398000"],"v":["634.16451067","2117.88824812"],"p":["41908.87381","41673.47318"],"t":[7215,21126],"l":["40772.20000","40772.20000"],"h":["42474.30000","42571.50000"],"o":["41016.00000","41898.80000"]},"ticker","XBT/USD"]
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
[324,{"a":["42255.00000",0,"0.08406816"],"b":["42243.10000",6,"6.33160603"],"c":["42255.00000","0.01593184"],"v":["634.19504419","2117.90471127"],"p":["41908.89020","41673.47996"],"t":[7217,21123],"l":["40772.20000","40772.20000"],"h":["42474.30000","42571.50000"],"o":["41016.00000","41908.00000"]},"ticker","XBT/USD"]
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
[324,{"a":["42254.80000",0,"0.53200000"],"b":["42251.60000",0,"0.10000000"],"c":["42254.80000","0.05800000"],"v":["634.25304419","2117.94005439"],"p":["41908.92184","41673.49337"],"t":[7218,21122],"l":["40772.20000","40772.20000"],"h":["42474.30000","42571.50000"],"o":["41016.00000","41922.40000"]},"ticker","XBT/USD"]
{"event":"heartbeat"}
{"event":"heartbeat"}
{"event":"heartbeat"}
[324,{"a":["42248.60000",2,"2.84602281"],"b":["42247.00000",0,"0.12500000"],"c":["42248.60000","0.04168347"],"v":["634.29472766","2117.98132192"],"p":["41908.94416","41673.50464"],"t":[7219,21122],"l":["40772.20000","40772.20000"],"h":["42474.30000","42571.50000"],"o":["41016.00000","41922.40000"]},"ticker","XBT/USD"]
[324,{"a":["42248.60000",2,"2.83204281"],"b":["42246.90000",0,"0.10000000"],"c":["42248.60000","0.01398000"],"v":["634.30870766","2117.99530192"],"p":["41908.95164","41673.50844"],"t":[7220,21123],"l":["40772.20000","40772.20000"],"h":["42474.30000","42571.50000"],"o":["41016.00000","41922.40000"]},"ticker","XBT/USD"]
{"event":"heartbeat"}
{"event":"heartbeat"}
Note that heartbeat messages are sent at a frequency of 1 per second when there is no ticker (or other market data) available.
Details of the individual fields/values within the JSON messages for the ticker feed (and all of the other market data feeds) are available in our WebSocket API v1 documentation.