Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sieblyio/kraken-api/llms.txt

Use this file to discover all available pages before exploring further.

DerivativesClient provides full access to the Kraken Futures REST API. It covers all perpetual and fixed-maturity contract markets — market data, order book snapshots, candles, open positions, fill history, account state, leverage settings, batch order management, and transfers between Futures and Spot wallets. All live requests are routed to https://futures.kraken.com.
Kraken Futures uses separate API keys from the Spot exchange. Generate dedicated Futures API keys in your Kraken account under Settings → API → Futures. Spot API keys will not authenticate Futures endpoints.

Constructor

import { DerivativesClient } from '@siebly/kraken-api';

// Public market data requires no authentication
const client = new DerivativesClient();
The demo environment (testnet: true) points to https://demo-futures.kraken.com. It is intended for API integration testing — the order book dynamics and liquidity differ significantly from production.

Symbol Conventions

Kraken Futures symbols follow a structured prefix convention that identifies the contract type:
PrefixTypeExample
PF_Perpetual Futures (multi-collateral)PF_BTCUSD, PF_ETHUSD
PI_Perpetual Inverse FuturesPI_XBTUSD
FI_Inverse Fixed-Maturity FuturesFI_XBTUSD_250328
FF_Flex (multi-collateral) Fixed-Maturity FuturesFF_XBTUSD_250328
IN_IndexIN_XBTUSD
Use getInstruments() to fetch the full list of currently listed symbols with their specifications.

generateNewOrderID()

DerivativesClient exposes a generateNewOrderID() helper that returns a cryptographically random 32-character string using nanoid. Use this to generate a unique cliOrdId for each order you submit. Client order IDs let you idempotently track and reference your orders even before Kraken assigns an internal order ID.
const orderId = client.generateNewOrderID();
// e.g. "V_Rq2Kz7Xn1mPdL0oEuJhsYgCbWiAe8f"

await client.submitOrder({
  orderType: 'lmt',
  symbol: 'PF_BTCUSD',
  side: 'buy',
  size: 0.01,
  limitPrice: 30000,
  cliOrdId: orderId,
});
Always generate a fresh cliOrdId per order. Reusing the same ID across orders will result in a rejection.

Available Endpoints

Public methods require no authentication.
MethodDescription
getInstruments()All currently listed contracts and indices with full specifications (tick size, contract size, leverage, etc.).
getInstrumentStatusList()Price dislocation and volatility status for all markets.
getInstrumentStatus(params)Price dislocation and volatility status for a single market.
getTickers()Live market data for all contracts and indices (last price, mark price, bid/ask, 24h volume, open interest, funding rate).
getTicker(params)Market data for a single contract or index by symbol.
getOrderbook(params)Full non-cumulative order book for a contract.
getTradeHistory(params)The 100 most recent trades for a symbol (up to 7 days back).
getHistoricalFundingRates(params)Historical funding rate series for a perpetual contract.
getFeeSchedules()All fee schedules with maker/taker tiers. Deprecated as of 2026-06-22 — use SpotClient.getTradingVolume() instead.
getPublicExecutionEvents(params)Public trade executions for a market (market history).
getPublicOrderEvents(params)Public order events for a market.
getPublicMarkPriceEvents(params)Public mark price events for a market.
getTickTypes()Available tick types for use with the candle endpoints.
getMarketsForTickType(params)Markets available for a given tick type.
getResolutions(params)Candle resolutions available for a given tick type and symbol.
getCandles(params)OHLC candles for a given tick type, symbol, and resolution.
getLiquidityPoolStatistic(params)Liquidity pool statistics including USD value.
getMarketAnalytics(params)Market analytics data in time buckets.
getOpenRFQs()All currently open RFQs (demo environment only).
getOpenRFQ(params)A single open RFQ by UID (demo environment only).

Usage Examples

Public Market Data

import { DerivativesClient } from '@siebly/kraken-api';

const client = new DerivativesClient();

// All tickers — mark price, bid/ask, volume, funding rate
const tickers = await client.getTickers();
console.log('All Tickers:', JSON.stringify(tickers, null, 2));

// Order book for a specific perpetual contract
const orderBook = await client.getOrderbook({ symbol: 'PF_ETHUSD' });
console.log('Order Book:', JSON.stringify(orderBook, null, 2));

Account

import { DerivativesClient } from '@siebly/kraken-api';

const client = new DerivativesClient({
  apiKey: process.env.API_FUTURES_KEY,
  apiSecret: process.env.API_FUTURES_SECRET,
});

const wallets = await client.getAccounts();
// wallets.result.accounts contains:
// - cash: { balances: { XBT, USDT, ... } }
// - flex: { currencies: {...}, auxiliary: { pv, pnl, af, funding }, marginRequirements: { im, mm } }
console.log('Accounts:', JSON.stringify(wallets, null, 2));

Order Management

import { DerivativesClient } from '@siebly/kraken-api';

const client = new DerivativesClient({
  apiKey: process.env.API_FUTURES_KEY,
  apiSecret: process.env.API_FUTURES_SECRET,
});

// Limit buy order
const limitOrder = await client.submitOrder({
  orderType: 'lmt',
  symbol: 'PF_ETHUSD',
  side: 'buy',
  size: 0.01,
  limitPrice: 1000,
  cliOrdId: client.generateNewOrderID(),
});
console.log('Limit Order:', JSON.stringify(limitOrder, null, 2));

// Market sell order
const marketOrder = await client.submitOrder({
  orderType: 'mkt',
  symbol: 'PF_ETHUSD',
  side: 'sell',
  size: 0.01,
});
console.log('Market Order:', JSON.stringify(marketOrder, null, 2));

Position Management

import { DerivativesClient } from '@siebly/kraken-api';

const client = new DerivativesClient({
  apiKey: process.env.API_FUTURES_KEY,
  apiSecret: process.env.API_FUTURES_SECRET,
});

const positions = await client.getOpenPositions();
// Each position: { symbol, side, size, price, fillTime, unrealizedFunding }
console.log('Open Positions:', JSON.stringify(positions, null, 2));

Further Reading

Market Data Reference

Full parameter documentation for all public Futures endpoints.

Account Reference

Wallets, positions, fills, and history endpoint details.

Orders Reference

Order types, batch management, and Dead Man’s Switch details.

Build docs developers (and LLMs) love