Cancel on Disconnect
REQUESTwss://ws-auth.kraken.com
cancelAllOrdersAfterAuthentication Required
cancelAllOrdersAfter
request provides a "Dead Man's Switch" mechanism to protect the client from network malfunction, extreme latency or unexpected matching engine downtime. The client can send a request with a timeout (in seconds), that will start a countdown timer which will cancel all client orders when the timer expires. The client has to keep sending new requests to push back the trigger time, or deactivate the mechanism by specifying a timeout of 0. If the timer expires, all orders are cancelled and then the timer remains disabled until the client provides a new (non-zero) timeout.
The recommended use is to make a call every 15 to 30 seconds, providing a timeout of 60 seconds. This allows the client to keep the orders in place in case of a brief disconnection or transient delay, while keeping them safe in case of a network breakdown. It is also recommended to disable the timer ahead of regularly scheduled trading engine maintenance (if the timer is enabled, all orders will be cancelled when the trading engine comes back from downtime - planned or otherwise).
Request
- Request Schema
- Example
MESSAGE BODY
cancelAllOrdersAfter
{
"event": "cancelAllOrdersAfter",
"reqid": 1608543428050,
"timeout": 60,
"token": "0000000000000000000000000000000000000000"
}
Response
- Response Schema
- Example: Enabled
- Example: Disabled
MESSAGE BODY
cancelAllOrdersAfterStatus
ok
, error
] {
"currentTime": "2020-12-21T09:37:09Z",
"event": "cancelAllOrdersAfterStatus",
"reqid": 1608543428050,
"status": "ok",
"triggerTime": "2020-12-21T09:38:09Z"
}
{
"currentTime": "2020-12-21T09:37:09Z",
"event": "cancelAllOrdersAfterStatus",
"reqid": 1608543428051,
"status": "ok",
"triggerTime": "0"
}