The WebSocket API v1 openOrders feed is a private account management feed, that provides a real time status of all open orders that are associated with your Kraken account.
Any changes to the status of an order, such as a new order being placed, an order being partially or fully filled or an order being cancelled, will cause an update message to be sent via the openOrders feed.
How to subscribe
Once a connection to the WebSocket API v1 has been established, the openOrders feed can be subscribed to by retrieving an authentication token via the REST API GetWebSocketsToken endpoint, and then sending a subscription message like the following:
- {"event":"subscribe", "subscription":{"name":"openOrders", "token":"WOg6IVQ5RfogMzkhH25WOg6IVQ5RqhP+U3ZprQVnh7f"}}
Example feed
The following is an example of the openOrders feed, illustrating the type of messages that are received for various order status changes:
{"connectionID":14950811667203285981,"event":"systemStatus","status":"online","version":"0.3.0"}{"channelName":"openOrders","event":"subscriptionStatus","status":"subscribed","subscription":{"name":"openOrders"}}[[], "openOrders"]{"event":"heartbeat"}{"event":"heartbeat"}[[{"OH6WIE-OYECX-FIIN3H":{"avg_price":"0.00000","cost":"0.00000","descr":{"close":"","leverage":"5:1","order":"buy 0.00200000 ETH/USD @ limit 100.00000 with 5:1 leverage","ordertype":"limit","pair":"ETH/USD","price":"100.00000","price2":"0.00000","type":"buy"},"expiretm":"1570445592","fee":"0.00000","limitprice":"0.00000","misc":"","oflags":"fciq","opentm":"1570445562.883878","refid":null,"starttm":null,"status":"pending","stopprice":"0.00000","userref":0,"vol":"0.00200000","vol_exec":"0.00000000"}}],"openOrders"][[{"OH6WIE-OYECX-FIIN3H":{"status":"open"}}],"openOrders"]{"event":"heartbeat"}{"event":"heartbeat"}[[{"OH6WIE-OYECX-FIIN3H":{"status":"canceled"}}],"openOrders"]{"event":"heartbeat"}{"event":"heartbeat"}
Upon subscribing to the openOrders feed, a subscription status message is received:
- {"channelName":"openOrders","event":"subscriptionStatus","status":"subscribed","subscription":{"name":"openOrders"}}
followed by an empty snapshot which indicates that the account does not have any currently open orders:
- [[], "openOrders"]
When a new order is placed, an initial message is received providing the details of the order, immediately followed by a message indicating a status change from pending to open:
- [[{"OH6WIE-OYECX-FIIN3H":{"avg_price":"0.00000","cost":"0.00000","descr":{"close":"","leverage":"5:1","order":"buy 0.00200000 ETH/USD @ limit 100.00000 with 5:1 leverage","ordertype":"limit","pair":"ETH/USD","price":"100.00000","price2":"0.00000","type":"buy"},"expiretm":"1570445592","fee":"0.00000","limitprice":"0.00000","misc":"","oflags":"fciq","opentm":"1570445562.883878","refid":null,"starttm":null,"status":"pending","stopprice":"0.00000","userref":0,"vol":"0.00200000","vol_exec":"0.00000000"}}],"openOrders"]
- [[{"OH6WIE-OYECX-FIIN3H":{"status":"open"}}],"openOrders"]
A few seconds later, the order is cancelled (before it has been executed/filled), causing an order cancellation message with a change of status from open to canceled:
- [[{"OH6WIE-OYECX-FIIN3H":{"status":"canceled"}}],"openOrders"]
The decimal and thousands separators shown in this article may differ from the formats displayed on our trading platforms. Review our article on how we use points and commas for more information.