Поиск
WebSocket API v1 Private Feeds - ownTrades
The WebSocket API v1 ownTrades feed is a private account management feed, that provides a real time notification of all trades that are executed by your Kraken account.
Every trade that occurs as a result of one of your orders will cause a new message to be sent via the ownTrades feed.

How to subscribe

Once a connection to the WebSocket API v1 has been established, the ownTrades 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":"ownTrades", "token":"WOg6IVQ5RfogMzkhH25WOg6IVQ5RqhP+U3ZprQVnh7f"}}

Example feed

The following is an example of the ownTrades feed:
{"connectionID":12678739536485265125,"event":"systemStatus","status":"online","version":"0.3.0"}{"channelName":"ownTrades","event":"subscriptionStatus","status":"subscribed","subscription":{"name":"ownTrades"}}[[{"T7YS4M-6HGBO-GDAGOY":{"cost":"70.19110","fee":"0.18250","margin":"0.00000","ordertxid":"OPJVQI-PXMPK-4WT5WP","ordertype":"market","pair":"XBT/USD","postxid":"TKH2SE-M7IF5-CFI7LT","price":"8092.20053","time":"1570270020.122169","type":"buy","vol":"0.00867392"}},{"TNN4V7-BTS6X-O3CQF3":{"cost":"54.00046","fee":"0.14040","margin":"0.00000","ordertxid":"OKIRSX-DUS37-W33QZN","ordertype":"market","pair":"XBT/USD","postxid":"TKH2SE-M7IF5-CFI7LT","price":"8090.59895","time":"1570269988.387027","type":"sell","vol":"0.00667447"}}], "ownTrades"]{"event":"heartbeat"}{"event":"heartbeat"}[[{"T7GUL2-5N7YZ-QVQDCJ":{"cost":"0.35002","fee":"0.00098","margin":"0.07000","ordertxid":"OMBOUS-KM52J-NGDZH6","ordertype":"market","pair":"ETH/USD","posstatus":"Opened","postxid":"TKH2SE-M7IF5-CFI7LT","price":"175.01000","time":"1570447638.474936","type":"buy","vol":"0.00200000"}}],"ownTrades"]{"event":"heartbeat"}{"event":"heartbeat"}[[{"TEY4EI-7WY6F-YJRXQF":{"cost":"0.35000","fee":"0.00091","margin":"0.00000","ordertxid":"OVNJYW-XAEHY-IUN4EH","ordertype":"market","pair":"ETH/USD","posstatus":"Closing","postxid":"T6KC22-6XWFG-ZWYYTG","price":"175.00000","time":"1570447652.939563","type":"sell","vol":"0.00200000"}}],"ownTrades"]{"event":"heartbeat"}{"event":"heartbeat"}
Upon subscribing to the ownTrades feed, a subscription status message is received:
  • {"channelName":"ownTrades","event":"subscriptionStatus","status":"subscribed","subscription":{"name":"ownTrades"}}
followed by a snapshot with details of any recently executed trades for the account:
  • [[{"T7YS4M-6HGBO-GDAGOY":{"cost":"70.19110","fee":"0.18250","margin":"0.00000","ordertxid":"OPJVQI-PXMPK-4WT5WP","ordertype":"market","pair":"XBT/USD","postxid":"TKH2SE-M7IF5-CFI7LT","price":"8092.20053","time":"1570270020.122169","type":"buy","vol":"0.00867392"}},{"TNN4V7-BTS6X-O3CQF3":{"cost":"54.00046","fee":"0.14040","margin":"0.00000","ordertxid":"OKIRSX-DUS37-W33QZN","ordertype":"market","pair":"XBT/USD","postxid":"TKH2SE-M7IF5-CFI7LT","price":"8090.59895","time":"1570269988.387027","type":"sell","vol":"0.00667447"}}], "ownTrades"]
When any new trades are executed, messages are received providing the details of the trades. The following messages indicate two separate trades, which initially opened a long ETH position on ETHUSD, and shortly afterwards closed the position:
  • [[{"T7GUL2-5N7YZ-QVQDCJ":{"cost":"0.35002","fee":"0.00098","margin":"0.07000","ordertxid":"OMBOUS-KM52J-NGDZH6","ordertype":"market","pair":"ETH/USD","posstatus":"Opened","postxid":"TKH2SE-M7IF5-CFI7LT","price":"175.01000","time":"1570447638.474936","type":"buy","vol":"0.00200000"}}],"ownTrades"]
  • [[{"TEY4EI-7WY6F-YJRXQF":{"cost":"0.35000","fee":"0.00091","margin":"0.00000","ordertxid":"OVNJYW-XAEHY-IUN4EH","ordertype":"market","pair":"ETH/USD","posstatus":"Closing","postxid":"T6KC22-6XWFG-ZWYYTG","price":"175.00000","time":"1570447652.939563","type":"sell","vol":"0.00200000"}}],"ownTrades"]
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.