Skip to main content

Kraken Spot Trade Connector

Features

crypto-krakenConnector Key
Instruments
FX
Request Types
SUBMITCANCELREPLACE
Order Types
MARKETLIMIT
Time In Force
IOCFOKGTCGTD
Order ID Mapper
COMPOSITE
Order Status Request
Cancel On Disconnect
Commission
Post Only
Fast Cancel
Fast Replace

Notes

Nonce Window

A nonce window allows API requests with a nonce slightly lower than the previously used value without returning an EAPI:Invalid nonce error. The connector's nonce is time-based, in milliseconds. See Why am I getting Invalid Nonce Errors?.

note

The API Key's Nonce Window must be set to 0.

Rate Limits

The Spot API rate limits are divided into three sections (public, private, trading) depending upon the API interface being used (REST or WebSocket) and the type of call that is being made (market data, account management, placing/cancelling/replacing orders).

The connector uses WebSocket API v2 to send place/cancel/replace requests.

Minimum Order Sizes

https://support.kraken.com/hc/en-us/articles/205893708-What-is-the-minimum-order-size-

Margin Trading

Connector supports margin trading using the maximum leverage for the pair (maximum is leverage of 5).

Info about leverage and margin:

Ways to setup margin trading (last takes highest priority):

  • margin connector setting
  • 6002 custom attribute.

Cancel All Orders After

Kraken 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.

Config block sample:

cancelAllOrdersAfter {
period = 30s
timeout = 60s
}

Self Match Prevention Instruction

When selfMatchPreventionInstruction setting is not defined or defined as DEFAULT, the exchange applies CANCEL_TAKING (cancel_newest) by default.

Symbology

Currency pairs in BASE/QUOTE format, e.g. XBT/USD, LTC/USD.

For the full list of available currency pairs, see the exchange GUI or query the REST API:

warning

If symbols are specified with currency code prefixes, the exchange may return them without those prefixes, causing instrument lookup failures and unmatched orders.

Configuration

Connector settings

ParameterDefault ValueDescription
tradingTypeSPOTWhen set to MARGIN, funds orders on margin using the maximum leverage for the pair (maximum is leverage of 5). Supported values: SPOT, MARGIN.
webSocketRequestTimeout3mAfter this time interval websocket request will be considered as lost. Decrease it carefully, can happen that order will be lost and discarded when it have not been created on exchange yet.
uncertainErrors["EService:Unavailable", "EGeneral:Internal error", "EService:Busy"]List of uncertain errors. When one of them happened on submission, order will be marked as lost (else rejected).
deadline10sTimestamp after which matching engine should reject new order request, in presence of latency or order queueing. min 5 seconds, max 90 seconds. Defaults to 90 seconds if not specified.
cancelAllOrdersAfternot enabledHas two settings: period, timeout. This feature can work like Cancel-On-Disconnect behavior. https://docs.kraken.com/websockets/#message-cancelAllOrdersAfter
selfMatchPreventionInstructionDEFAULTOptional setting for Self-Trade Prevention function. Supported values: DEFAULT, CANCEL_RESTING, CANCEL_TAKING, CANCEL_BOTH.
pingPeriod60sPing requests period.
staleWebsocketTimeout3sTimeout for reconnection when no websockets messages received from the exchange.

Supported order attributes

KeyDescription
186 value used for post only orders submission
6002When set to MARGIN, funds the order on margin using the maximum leverage for the pair (maximum is leverage of 5). Supported values: SPOT, MARGIN.

Config sample

connectors {
KRAKEN: ${template.connector.crypto.kraken} {
settings {
restUrl = "https://api.kraken.com"
websocketUrl = "wss://ws-auth.kraken.com/v2"

apiKeys: [{
apiKey = "<API_KEY>"
apiSecret = "<API_SECRET>"
}]
}
}
}