URL: wss://futures.kraken.com/ws/v1
The subscribe and unsubscribe requests to WebSocket private feeds require a signed challenge message with the user api_secret.
The challenge is obtained as is shown in Section WebSocket API Public (using the api_key).
Authenticated requests must include both the original challenge message (original_challenge) and the signed (signed_challenge) in JSON format.
In order to get a Websockets Challenge, an API Key and API Secret must be set in Kraken Options Component, the api key provided by Kraken in your account
Kraken.ApiKey := 'api key';
Kraken.ApiSecret := 'api secret';
This subscription feed publishes information about user open orders. This feed adds extra information about all the post-only orders that failed to cross the book.
SubscribeOpenOrdersVerbose();
Later, you can unsubscribe from OpenOrdersVerbose, calling UnSubscribeOpenOrdersVerbose method
UnSubscribeOpenOrdersVerbose();
Response example from server
{ 'feed':'open_orders_verbose_snapshot', 'account':'0f9c23b8-63e2-40e4-9592-6d5aa57c12ba', 'orders':[ { 'instrument':'PI_XBTUSD', 'time':1567428848005, 'last_update_time':1567428848005, 'qty':100.0, 'filled':0.0, 'limit_price':8500.0, 'stop_price':0.0, 'type':'limit', 'order_id':'566942c8-a3b5-4184-a451-622b09493129', 'direction':0, 'reduce_only':False } ]}
This subscription feed publishes the open positions of the user account.
SubscribeOpenPositions();
Later, you can unsubscribe from OpenPositions, calling UnSubscribeOpenPositions method
UnSubscribeOpenPositions();
Response example from server
{ "feed": "open_positions", "account": "DemoUser", "positions": [{ "instrument": "fi_xbtusd_180316", "balance": 2000.0, "entry_price": 11675.86541981, "mark_price": 11090.0, "index_price": 12290.550000000001, "pnl": -0.00905299 }] }
This subscription feed publishes account information.
SubscribeAccountLog();
Later, you can unsubscribe from AccountLog, calling UnSubscribeAccountLog method
UnSubscribeAccountLog();
Response example from server
{ 'feed': 'account_log_snapshot', 'logs': [{ 'id': 1690, 'date': '2019-07-11T08:00:00.000Z', 'asset': 'bch', 'info': 'funding rate change ',' booking_uid ':' 86 fdc252 - 1 b6e - 40 ec - ac1d - c7bd46ddeebf ',' margin_account ':' f - bch: usd ',' old_balance ':0.01215667051,' new_balance ':0.01215736653,' old_average_entry_price ':0.0,' new_average_entry_price ':0.0,' trade_price ':0.0,' mark_price ':0.0,' realized_pnl ':0.0,' fee ':0.0,' execution ':' ',' collateral ':' bch ',' funding_rate ':-8.7002552653e-08,' realized_funding ':6.9602e-07}] }
This subscription feed publishes fills information.
SubscribeFills();
Later, you can unsubscribe from Fills, calling UnSubscribeFills method
UnSubscribeFills();
Response example from server
{
"feed":"fills_snapshot",
"account":"DemoUser",
"fills":[
{
"instrument":"FI_XBTUSD_200925",
"time":1600256910739,
"price":10937.5,
"seq":36,
"buy":true,
"qty":5000.0,
"order_id":"9e30258b-5a98-4002-968a-5b0e149bcfbf",
"fill_id":"cad76f07-814e-4dc6-8478-7867407b6bff",
"fill_type":"maker",
"fee_paid":-0.00009142857,
"fee_currency":"BTC"
}]
}
This subscription feed publishes information about user open orders.
SubscribeOpenOrders();
Later, you can unsubscribe from OpenOrders, calling UnSubscribeOpenOrders method
UnSubscribeOpenOrders();
Response example from server
{
"feed": "open_orders_snapshot",
"account": "e258dba9-4dd4-4da5-bfef-75beb91c098e",
"orders": [
{
"instrument": "PI_XBTUSD",
"time": 1612275024153,
"last_update_time": 1612275024153,
"qty": 1000,
"filled": 0,
"limit_price": 34900,
"stop_price": 13789,
"type": "stop",
"order_id": "723ba95f-13b7-418b-8fcf-ab7ba6620555",
"direction": 1,
"reduce_only": false,
"triggerSignal": "last"
}
]
}
This subscription feed returns balance and margin information for the client's account.
SubscribeAccountBalanceAndMargins();
Later, you can unsubscribe from AccounBalance, calling UnSubscribeAccountBalanceAndMargins method
UnSubscribeAccountBalanceAndMargins();
Response example from server
{
"feed": "account_balances_and_margins",
"account": "DemoUser",
"margin_accounts": [
{
"name": "xbt",
"balance": 0,
"pnl": 0,
"funding": 0,
"pv": 0,
"am": 0,
"im": 0,
"mm": 0
},
{
"name": "f-xbt:usd",
"balance": 9.99730211055,
"pnl": -0.00006034858674327812,
"funding": 0,
"pv": 9.997241761963258,
"am": 9.99666885201038,
"im": 0.0005729099528781564,
"mm": 0.0002864549764390782
},
],
"seq": 14
}
This subscription feed publishes notifications to the client.
SubscribeNotifications();
Later, you can unsubscribe from Notifications, calling UnSubscribeNotifications method
UnSubscribeNotifications();
Response example from server
{
"feed":"notifications_auth",
"notifications":[
{
"id":5,
"type":"market",
"priority":"low",
"note":"A note describing the notification.",
"effective_time":1520288300000
},
...
]
}