Skip to main content

Trading on Kraken

Kraken is the only supported exchange that runs two separate products behind a single account: Kraken Spot at api.kraken.com and Kraken Futures at futures.kraken.com. They have separate API key management, different signing schemes, and different symbol formats. OEMS hides most of this. You register one exchange account (one exchange_account_id), provide one credential pair for spot and an optional second pair for futures, and OEMS routes every call to the right product behind the scenes. This guide walks through the full flow.

1. Set up your Kraken API keys

You’ll need two API keys, generated independently. Create both in Kraken Pro (web UI), one in the Spot area and one in the Futures area.

Spot key (api.kraken.com)

In Kraken Pro → Settings → API → Manage API Keys, generate a key with these permissions:
  • ✅ Query Funds (required for balance / position polling)
  • ✅ Query Open Orders & Trades
  • ✅ Query Closed Orders & Trades
  • ✅ Query Ledger Entries
  • ✅ Create & Modify Orders (for spot order placement)
  • ✅ Cancel/Close Orders
  • ❌ Withdraw Funds, DO NOT enable
  • ❌ Deposit Funds, not needed for trading
Set Nonce Window = 10000 ms. This absorbs cross-process nonce drift between OEMS, the polling jobs, and any other services sharing the key. The default 5000 ms is fine for a single-process integration but tight for ours.

Futures key (futures.kraken.com)

Open futures.kraken.com → Settings → API Keys. Generate a separate key with:
  • ✅ Read (account / positions / orders)
  • ✅ Trade (place / cancel orders)
  • ❌ Withdraw, DO NOT enable
Kraken Futures’ UI does not expose a per-key nonce window setting. That’s fine, OEMS uses microsecond nonces and few processes hit the futures key, so collisions are very unlikely.

2. Register the account in OEMS

You can configure the keys at registration or add them later.

Option A, at registration time

Either credential pair can be omitted. Spot-only or futures-only are both valid configurations:
  • Spot only: Trading futures pairs returns PERMISSION_DENIED: futures key not configured.
  • Futures only: Trading spot pairs returns the equivalent.

Option B, add the futures key later

If the account already exists with only the spot pair, send a PUT to the credentials endpoint:
Same path can be used to rotate keys (overwrite) or clear them (send "" or null for the value). Behind the scenes:
  • Each value is encrypted via the same SECRET_KEY-derived AES path as the spot keys; it sits in the same params JSONB column.
  • The cached CCXT instances for the account are invalidated, so the next OEMS call re-instantiates with the new credentials.

3. Symbol conventions

Kraken Spot and Kraken Futures use different symbol formats. OEMS accepts CCXT’s unified format for both. When you call /order-execution/execution/order with market_type: "swap" and a Kraken account, OEMS resolves to ccxt.krakenfutures and expects the symbol to be in CCXT futures format (BTC/USD:USD).

4. Move funds to the right wallet

Kraken Spot and Kraken Futures hold balances in separate wallets. A USDT balance on the spot side can’t margin a futures order, you need to transfer it across.

Check both wallets

Transfer spot → futures

The /transfer endpoint is unified across exchanges that support inter-wallet moves (Kraken, Binance, OKX, Gate.io). On exchanges with a single unified wallet (Bybit UTA, Hyperliquid) it returns NOT_SUPPORTED.

5. Set leverage and margin mode (futures only)

Set leverage

Set margin mode

Kraken Futures models margin mode as a per-pair leverage preference:
  • isolated: a leverage preference is set for the symbol
  • cross: no leverage preference is set (default)
CCXT’s unified set_margin_mode is not implemented for krakenfutures. OEMS works around this via an adapter override that calls Kraken’s /derivatives/api/v3/leveragepreferences endpoint directly. From the caller’s perspective the unified /margin-mode route just works.

6. Place orders

The /order-execution/execution/order endpoint takes the same shape regardless of spot / perp, only symbol, market_type, and a few perp-specific flags (reduce_only) change between the two.

Spot market buy

Perp limit order, post-only

Perp stop-loss with reduce-only

Perp take-profit with reduce-only

Stop-limit (limit triggered at stop price)


7. Read positions and close

Get open positions

Response:

Close a position

OEMS doesn’t have a separate “close position” verb, close via a reduce_only market order in the opposite direction:

8. Funding and realized PnL

Funding rate history

Kraken Futures publishes funding rates as a schedule (per-rate history), not as discrete payment events. OEMS sources this from fetch_funding_rate_history and returns the unified payments shape.

Realized PnL

Kraken Futures has no “income” endpoint analogous to Binance. OEMS aggregates realized PnL from fetch_my_trades, each trade that closes (or partially closes) a position carries realisedPnl in its info payload. OEMS filters and returns just the PnL events.

9. Troubleshooting

EAPI:Invalid nonce

The same Kraken key was used by another process in the recent past with a higher nonce. Set Nonce Window = 10000 ms on the spot key in Kraken Pro → API → Manage API Keys (per the setup section above). The futures-side UI doesn’t expose this setting; the microsecond override OEMS applies is normally sufficient there.

EGeneral:Permission denied

The key is valid but lacks a permission for the operation. Most common: missing Query Funds on the spot key. Update permissions in Kraken Pro and retry. OEMS surfaces this with an explicit PERMISSION_DENIED rather than the generic “wrong key” message.

authenticationError from krakenfutures

You’re trying to use a spot key against the futures API. Spot keys cannot sign futures requests. Configure a separate futures key per the setup section, then either re-register or use the PUT /credentials endpoint to add it.

Order rejected with wouldNotReducePosition

A reduce-only order’s quantity exceeds the open position size, or the order is in the wrong direction to reduce. Check /positions first and place a smaller / opposite order.

Spot-purchased BTC shows up under “Staking/Yield Farming”

Kraken auto-allocates spot balances to Flex Earn by default in many regions. This is a Kraken account setting, disable Auto-allocate to Earn in Kraken Pro → Earn → Allocations to keep new spot purchases in the trading wallet, or un-allocate the existing balance manually.

Quick reference