Kraken
Kraken (Spot): Kraken spot trading (Kraken REST API https://api.kraken.com), accessed with a Kraken API Key and Secret Key. The account is the Kraken spot balance, with the available amount being the balance minus what open orders hold; Kraken Futures is a separate exchange object, Futures_Kraken.
Futures_Kraken (Futures): Kraken Futures (Kraken Futures API https://futures.kraken.com): inverse (coin-margined) perpetual and delivery contracts, multi-collateral (linear) perpetual and delivery contracts, and Kraken Futures options. Access uses a Kraken Futures API Key and Secret Key; Kraken spot is a separate exchange object, Kraken.
Names and Configuration
exchange.GetName() | Type | Aliases |
|---|---|---|
Kraken | Spot | — |
Futures_Kraken | Futures | Kraken Futures |
| Field | Required | |
| - | - | |
| Access Key | Yes | |
| Secret Key | Yes |
Trading Pairs and Contract Codes
Kraken (Spot)
Pair examples: BTC_USD, ETH_USDT, BTC_EUR
Trading pairs are written BASE_QUOTE. Kraken writes BTC as XBT and DOGE as XDG; use BTC and DOGE in trading pairs (XBT_USD also works), and returned symbols always use BTC and DOGE.
Futures_Kraken (Futures)
Pair examples: BTC_USD, ETH_USD
Trading pairs look like BTC_USD; the contract code selects the contract type: codes without a suffix are inverse contracts (Kraken PI_, FI_), codes with the _pf or _ff suffix are multi-collateral contracts (PF_, FF_). Kraken contract codes write BTC as XBT; use BTC in the trading pair, and returned symbols always use BTC.
| Contract code | Description |
|---|---|
swap | Inverse perpetual contract (the default). |
month | The nearest-expiry inverse delivery contract. |
this_week | Same as month; written as month in exchange.GetMarkets and query results. |
quarter | Inverse quarterly contract (the nearest one expiring in March, June, September or December). |
next_quarter | Inverse next-quarter contract. |
third_quarter | Inverse third-quarter contract. |
swap_pf | Multi-collateral perpetual contract. |
month_ff | The nearest-expiry multi-collateral delivery contract. |
this_week_ff | Same as month_ff; written as month_ff in exchange.GetMarkets and query results. |
quarter_ff | Multi-collateral quarterly contract. |
next_quarter_ff | Multi-collateral next-quarter contract. |
third_quarter_ff | Multi-collateral third-quarter contract. |
Kraken lists monthly and quarterly delivery contracts only; this_week and month both mean the nearest expiry. Delivery contracts are picked by expiry from the exchange's contract list. When one contract belongs to several tiers (the nearest quarterly contract is also month, for example), exchange.GetMarkets and the symbols of tickers, positions and orders use only one of them, with the quarter tiers ahead of month; a delivery contract outside every tier uses its native code as the contract code (such as BTC_USD.FF_XBTUSD_261030). Each contract appears once in exchange.GetMarkets. Positions and open orders can be queried with the ranges USD.swap_pf (multi-collateral perpetuals) and USD.futures_ff (multi-collateral delivery).
Native contract code examples: FF_ETHUSD_250307, PF_XBTUSD
Contracts can be given by their Kraken native codes: delivery contracts (prefixes FI_, FF_) such as ETH_USD.FF_ETHUSD_250307, perpetuals (prefixes PI_, PF_) such as BTC_USD.PF_XBTUSD. exchange.SetContractType() also accepts the native codes of the current pair (including delivery contracts that belong to a tier and appear under the tier code in exchange.GetMarkets), for example exchange.SetContractType("PF_XBTUSD") with pair BTC_USD.
Exchange-specific IO Commands
Kraken (Spot)
No exchange-specific commands; for the common commands see exchange.IO.
Futures_Kraken (Futures)
| Command | Arguments | Description | Returns |
|---|---|---|---|
cross | bool[, symbol] | Cross (true) / isolated (false) margin, multi-collateral contracts only. Switching to isolated sets the leverage limit to 10x; change it afterwards with exchange.SetMarginLevel(). | Null also on success; check GetLastError() afterwards when needed. |
For the common commands api, base and currency see exchange.IO.
Function Support
All exchange objects
No unsupported standard functions.
Kraken (Spot)
Served through a fallback:
exchange.GetRecords: Native periods are 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 15d; other periods are synthesized by the docker.
Futures_Kraken (Futures)
Served through a fallback:
exchange.GetRecords: Native periods are 1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w; other periods are synthesized by the docker.
Margin, Account and Simulation
Futures_Kraken (Futures)
Margin mode: Only multi-collateral contracts (swap_pf, *_ff) can switch cross/isolated margin and set leverage; for inverse contracts and options exchange.IO("cross", ...) and exchange.SetMarginLevel() fail. Kraken expresses the margin mode through leverage preferences: exchange.SetMarginLevel() sets the leverage limit and also switches the contract to isolated margin, while exchange.IO("cross", true) removes the limit and returns to cross margin.
Position mode: The connector has no position-mode setting; exchange.IO("dual", ...) fails.
Account: Inverse contracts use their own single-currency wallets, and the Stocks of exchange.GetAccount() is that wallet's available coin amount; multi-collateral contracts and options use the multi-collateral wallet, where Balance is the available margin in USD.
Options
Futures_Kraken (Futures)
Kraken Futures options are supported. Limitations:
- Kraken has no option listing endpoint, so
exchange.GetMarkets()does not include option contracts; get the option codes from the Kraken website. - In
exchange.GetTicker(),Lastis the mark price when the contract has no last trade price, andBuy,Sell,HighandLoware 0 when nobody is quoting; the raw data inInfocarries the implied volatility, the greeks and other fields. - Options have no funding rate, and
exchange.SetMarginLevel()and margin-mode switching are not supported.
Option code examples: OF_ETHUSD_261225_4000_C, OF_XBTUSD_261225_100000_P
Option codes are Kraken native codes: OF_, underlying and quote currency, expiry (YYMMDD), strike, C/P, C for a call and P for a put. The underlying and quote currency in the code must match the trading pair, with BTC written as XBT; the full symbol looks like ETH_USD.OF_ETHUSD_261225_4000_C.
Notes
Kraken (Spot)
- The amount of a spot market buy order is in the base currency (Kraken's
volume), not a quote-currency amount. - Conditional orders support take-profit and stop-loss only, not OCO.
- Orders support
tifIOC and maker-only (postOnly, limit prices only); FOK is not supported and reports an error. exchange.ModifyOrder()andexchange.ModifyConditionOrder()are supported; both amend the order in place on Kraken and keep the order ID. Regular orders can change price and amount; conditional orders can change the trigger price, order price and amount.exchange.GetOrders()andexchange.GetConditionOrders()without arguments return the open orders of all trading pairs.exchange.GetHistoryOrders()andexchange.GetHistoryConditionOrders()return the latest 50 records whenlimitis not given, and page automatically to fill a largerlimit.
Futures_Kraken (Futures)
- Order amounts are Kraken contract sizes: one inverse contract is 1 USD, multi-collateral contracts are sized in the underlying coin (see
CtValandCtValCcyinexchange.GetMarkets). - Kraken's raw funding rate is an absolute amount per contract;
exchange.GetFundings()converts it to a relative rate. Perpetuals settle funding every hour. - Conditional orders support take-profit and stop-loss only, not OCO; they trigger on the last traded price.
- Limit orders support
tifIOC and maker-only (postOnly), but not FOK; market orders do not support FOK or maker-only, and conditional orders support neithertifnor maker-only; passing them reports an error. exchange.ModifyOrder()andexchange.ModifyConditionOrder()are supported (Kraken's edit-order endpoint); conditional orders can change the trigger price, order price and amount.