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.

All methods on this page interact with private, authenticated endpoints of the Kraken Futures API. You must initialise DerivativesClient with a valid API key and secret. The client handles request signing automatically.
import { DerivativesClient } from '@siebly/kraken-api';

const client = new DerivativesClient({
  apiKey: process.env.API_FUTURES_KEY,
  apiSecret: process.env.API_FUTURES_SECRET,
});
Kraken Futures API keys are separate from Spot API keys. Generate them from the Futures section of your Kraken account settings.

Account State

getAccounts()

Returns key information about all your Futures accounts — cash accounts, single-collateral margin accounts, and the multi-collateral flex account. Includes balances, margin requirements, margin trigger estimates, available funds, PnL of open positions, and portfolio value.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/accounts
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ accounts: FuturesAccounts }>> The FuturesAccounts object is a keyed map where each entry is one of:
  • FuturesCashAccounttype: 'cashAccount', with balances map
  • FuturesFlexAccounttype: 'multiCollateralMarginAccount', full margin breakdown
  • FuturesMarginAccount — single-collateral account with auxiliary, marginRequirements, and triggerEstimates
import { DerivativesClient } from '@siebly/kraken-api';

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

const response = await client.getAccounts();
const { accounts } = response;

// Cash account balances
console.log(accounts.cash?.balances);

// Multi-collateral flex account
const flex = accounts.flex;
if (flex) {
  console.log('Available margin:', flex.available);
  console.log('Portfolio value:', flex.portfolioValue);
  console.log('Maintenance margin:', flex.maintenanceMargin);
  console.log('PnL:', flex.pnl);
}

checkApiKeyV3()

Verifies your API key and returns its full details — access level, account UID, permissions, and any IP allow-list.
  • HTTP method: GET
  • Endpoint: api/auth/v1/api-keys/v3/check
  • Auth required: Yes
Returns: Promise<FuturesApiKeyV3Check>
const keyInfo = await client.checkApiKeyV3();

console.log('Account UID:', keyInfo.accountUid);
console.log('General access:', keyInfo.permissions.general);   // "NO_ACCESS" | "READ_ONLY" | "FULL_ACCESS"
console.log('Transfer access:', keyInfo.permissions.transfer);
console.log('Allowed CIDR:', keyInfo.allowedCidrBlock);

getNotifications()

Returns the platform’s current active notifications — scheduled maintenance, new features, market events, and more.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/notifications
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ notifications: FuturesNotification[] }>> Each FuturesNotification includes:
  • note — the notification message
  • prioritylow, medium, or high
  • typenew_feature, bug_fix, settlement, general, maintenance, or market
  • effectiveTime — ISO 8601 timestamp
  • expectedDowntimeMinutes — optional downtime duration for maintenance events
const response = await client.getNotifications();

for (const notification of response.notifications) {
  console.log(`[${notification.priority.toUpperCase()}] ${notification.type}: ${notification.note}`);
}

getAccountMarketShare()

Returns your account’s market share, volumes, and accrued rebates in contracts configured for rebates.
  • HTTP method: GET
  • Endpoint: api/stats/v1/rebates/self-market-share
  • Auth required: Yes
Returns: Promise<FuturesMarketShare>
Data may not be immediately available. In those cases the API returns HTTP 204, which the SDK surfaces as an empty response.
const marketShare = await client.getAccountMarketShare();

for (const [symbol, data] of Object.entries(marketShare.contracts)) {
  console.log(symbol, data.marketShare, data.volume, data.usdRebateCredited);
}

getAccountLog(params?)

Lists account log entries, paged by timestamp or by entry ID. Covers all account activity: futures trades, liquidations, funding rate charges, conversions, transfers, settlements, and fees.
  • HTTP method: GET
  • Endpoint: api/history/v3/account-log
  • Auth required: Yes
since
number
Return entries after this timestamp in milliseconds.
before
number
Return entries before this timestamp in milliseconds.
from
number
ID of the first entry to return (inclusive). Use for ID-based pagination.
to
number
ID of the last entry to return (inclusive). Use for ID-based pagination.
sort
'asc' | 'desc'
Sort order. desc returns newest entries first.
info
string[]
Filter by entry types, e.g. ['futures trade', 'transfer', 'funding rate change'].
count
number
Maximum number of entries to return.
conversion_details
boolean
Include conversion detail fields in the response.
Returns: Promise<DerivativesAPISuccessResponse<FuturesAccountLog>>
const log = await client.getAccountLog({
  count: 50,
  sort: 'desc',
});

for (const entry of log.logs) {
  console.log(entry.date, entry.info, entry.new_balance);
}

getAccountLogCsv(params?)

Returns recent account log entries in CSV format, suitable for export.
  • HTTP method: GET
  • Endpoint: api/history/v3/accountlogcsv
  • Auth required: Yes
conversion_details
boolean
Include conversion detail columns in the CSV output.
Returns: Promise<string>
const csv = await client.getAccountLogCsv({ conversion_details: true });

// Write to file, parse with a CSV library, etc.
require('fs').writeFileSync('account-log.csv', csv);

Positions

getOpenPositions()

Returns the size and average entry price of all open positions across all futures contracts, including matured but not yet settled contracts.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/openpositions
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ openPositions: FuturesOpenPosition[] }>> Each FuturesOpenPosition includes:
FieldTypeDescription
symbolstringFutures contract symbol
side'long' | 'short'Position direction
sizenumberPosition size in contracts
pricenumberAverage entry price
fillTimestringISO 8601 timestamp when position was opened
unrealizedFundingnumber | nullAccrued but unrealised funding
pnlCurrencystring | nullPnL settlement currency
const response = await client.getOpenPositions();

for (const position of response.openPositions) {
  console.log(
    position.symbol,
    position.side,
    position.size,
    '@',
    position.price,
  );
}

getPositionPercentile()

Returns each open position’s percentile in the unwind queue — useful for understanding liquidation priority.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/unwindqueue
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ queue: FuturesUnwindQueuePosition[] }>>
const response = await client.getPositionPercentile();

for (const entry of response.queue) {
  console.log(entry.symbol, `${entry.percentile}th percentile in unwind queue`);
}

getPositionEvents(params?)

Lists position update events — opened, closed, increased, decreased, reversed, and settled positions — for your account. Supports rich filtering by event type and time range.
  • HTTP method: GET
  • Endpoint: api/history/v3/positions
  • Auth required: Yes
since
number
Return events after this timestamp in milliseconds.
before
number
Return events before this timestamp in milliseconds.
sort
'asc' | 'desc'
Sort order.
count
number
Number of events to return per page.
continuation_token
string
Pagination token from a previous response.
tradeable
string
Filter to a specific symbol, e.g. PF_ETHUSD.
opened
boolean
Include position-opened events.
closed
boolean
Include position-closed events.
increased
boolean
Include position-increased events.
decreased
boolean
Include position-decreased events.
reversed
boolean
Include position-reversed events.
funding_realization
boolean
Include funding realisation events.
settlement
boolean
Include settlement events.
Returns: Promise<DerivativesAPISuccessResponse<FuturesHistoryResponse<FuturesPositionUpdateEvent>>>
const response = await client.getPositionEvents({
  tradeable: 'PF_ETHUSD',
  opened: true,
  closed: true,
  count: 50,
  sort: 'desc',
});

for (const element of response.elements) {
  const event = element.event as FuturesPositionUpdateEvent;
  console.log(event.positionChange, event.tradeable, event.newPosition);
}

Fills & Executions

getFills(params?)

Returns trade fill history for your account. Returns the 100 most recent fills, or fills before a specified time.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/fills
  • Auth required: Yes
lastFillTime
string
ISO 8601 timestamp. Returns the 100 most recent fills before this time.
Returns: Promise<DerivativesAPISuccessResponse<{ fills: FuturesFill[] }>> Each FuturesFill includes:
FieldTypeDescription
fill_idstringUnique fill identifier
order_idstringAssociated order ID
symbolstringFutures contract
side'buy' | 'sell' | 'unknown'Fill direction
sizenumberFill size
pricenumberFill price
fillTimestringISO 8601 execution timestamp
fillTypestringmaker, taker, liquidation, assignor, assignee, etc.
cliOrdIdstring | nullClient order ID if provided
const response = await client.getFills();

for (const fill of response.fills) {
  console.log(fill.symbol, fill.side, fill.size, '@', fill.price);
  console.log('  Fill type:', fill.fillType);
  console.log('  Order ID:', fill.order_id);
}

getExecutionEvents(params?)

Lists detailed execution events for your account using the history API. Provides richer data than getFills() and supports full pagination.
  • HTTP method: GET
  • Endpoint: api/history/v3/executions
  • Auth required: Yes
since
number
Return events after this timestamp in milliseconds.
before
number
Return events before this timestamp in milliseconds.
sort
'asc' | 'desc'
Sort order.
count
number
Number of events per page.
continuation_token
string
Pagination token from a previous response.
tradeable
string
Filter by symbol, e.g. PF_ETHUSD.
Returns: Promise<DerivativesAPISuccessResponse<FuturesHistoryResponse<FuturesHistoryExecutionEvent>>>
const response = await client.getExecutionEvents({
  tradeable: 'PF_ETHUSD',
  count: 50,
  sort: 'desc',
});

console.log(`${response.len} events returned`);
for (const element of response.elements) {
  console.log(element.uid, element.timestamp, element.event);
}

// Paginate
if (response.continuationToken) {
  const next = await client.getExecutionEvents({
    continuation_token: response.continuationToken,
  });
}

Orders

getOpenOrders()

Returns all currently open orders across all futures contracts.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/openorders
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ openOrders: FuturesOpenOrder[] }>> Each FuturesOpenOrder includes:
FieldTypeDescription
order_idstringUnique order identifier
cliOrdIdstring?Client-assigned order ID
status'untouched' | 'partiallyFilled'Fill status
side'buy' | 'sell' | 'unknown'Order direction
orderType'lmt' | 'stop' | 'take_profit' | 'unknown'Order type
symbolstringFutures contract
limitPricenumber?Limit price
stopPricenumber?Stop trigger price
filledSizenumberAmount already filled
unfilledSizenumber?Remaining unfilled quantity
reduceOnlybooleanWhether order is reduce-only
receivedTimestringISO 8601 timestamp when order was received
const response = await client.getOpenOrders();

for (const order of response.openOrders) {
  console.log(order.order_id, order.symbol, order.side, order.orderType);
  console.log('  Limit:', order.limitPrice, '| Filled:', order.filledSize);
}

getOrderStatus(params)

Returns the current status of specific orders — open orders, or orders filled/cancelled within the last 5 seconds. Query by order ID array, client order ID array, or both.
  • HTTP method: POST
  • Endpoint: derivatives/api/v3/orders/status
  • Auth required: Yes
orderIds
string[]
Array of exchange-assigned order IDs to query.
cliOrdIds
string[]
Array of client-assigned order IDs to query.
Returns: Promise<DerivativesAPISuccessResponse<{ orders: FuturesOrderStatusInfo[] }>>
const response = await client.getOrderStatus({
  orderIds: ['a04d0f84-36d4-4499-8382-96fcfc3ce7aa'],
});

for (const orderInfo of response.orders) {
  console.log(orderInfo.order.orderId, orderInfo.status, orderInfo.updateReason);
}

getOrderEvents(params?)

Lists the full order event history for your account — placements, cancellations, edits, rejections, and executions — with filtering by event type and symbol.
  • HTTP method: GET
  • Endpoint: api/history/v3/orders
  • Auth required: Yes
since
number
Return events after this timestamp in milliseconds.
before
number
Return events before this timestamp in milliseconds.
sort
'asc' | 'desc'
Sort order.
count
number
Number of events per page.
continuation_token
string
Pagination token from a previous response.
tradeable
string
Filter to a specific symbol.
opened
boolean
Include order-opened events.
closed
boolean
Include order-closed events.
Returns: Promise<DerivativesAPISuccessResponse<FuturesHistoryResponse<FuturesHistoryOrderEvent>>>
// Get the 50 most recent order events, newest first
const response = await client.getOrderEvents({
  count: 50,
  sort: 'desc',
  opened: true,
  closed: true,
});

// Filter by symbol
const ethEvents = await client.getOrderEvents({
  tradeable: 'PF_ETHUSD',
  count: 50,
});

getTriggerEvents(params?)

Lists trigger order events — placements, cancellations, and rejections of stop, take-profit, and trailing-stop triggers.
  • HTTP method: GET
  • Endpoint: api/history/v3/triggers
  • Auth required: Yes
Accepts the same parameters as getOrderEvents() (including opened, closed, since, before, count, sort, continuation_token, tradeable). Returns: Promise<DerivativesAPISuccessResponse<FuturesHistoryResponse<FuturesHistoryTriggerEvent>>>
const response = await client.getTriggerEvents({
  count: 50,
  sort: 'desc',
});

Preferences

getLeverageSettings()

Returns the configured leverage preferences for all futures contracts — showing max leverage per symbol and whether isolated or cross margin is in effect.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/leveragepreferences
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ leveragePreferences: FuturesLeveragePreference[] }>>
const response = await client.getLeverageSettings();

for (const pref of response.leveragePreferences) {
  console.log(pref.symbol, 'max leverage:', pref.maxLeverage);
}

setLeverageSettings(params)

Sets the leverage preference for a contract. Specifying a maxLeverage sets the contract to isolated margin mode with that leverage cap. Omitting maxLeverage sets it to cross margin.
  • HTTP method: PUT
  • Endpoint: derivatives/api/v3/leveragepreferences
  • Auth required: Yes
symbol
string
required
The futures symbol to configure, e.g. PF_ETHUSD.
maxLeverage
number
Maximum leverage multiplier. Omit for cross margin mode.
Returns: Promise<DerivativesAPISuccessResponse<Record<string, never>>>
// Set 10x isolated margin on PF_ETHUSD
await client.setLeverageSettings({
  symbol: 'PF_ETHUSD',
  maxLeverage: 10,
});

// Switch to cross margin
await client.setLeverageSettings({
  symbol: 'PF_ETHUSD',
});

getPnlPreferences()

Returns the PnL currency preferences per contract — the currency used to pay out realised gains on multi-collateral futures.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/pnlpreferences
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ preferences: FuturesPnlPreference[] }>>
const response = await client.getPnlPreferences();

for (const pref of response.preferences) {
  console.log(pref.symbol, 'PnL currency:', pref.pnlCurrency);
}

setPnlPreference(params)

Sets the PnL currency for a specific multi-collateral futures contract.
  • HTTP method: PUT
  • Endpoint: derivatives/api/v3/pnlpreferences
  • Auth required: Yes
symbol
string
required
The multi-collateral futures symbol to configure.
pnlPreference
string
required
The currency to use for PnL payouts, e.g. USD, USDT, BTC, ETH.
Returns: Promise<DerivativesAPISuccessResponse<Record<string, never>>> Possible errors: 87 (contract not found), 88 (not a multi-collateral contract), 89 (currency not found), 90 (currency not enabled for multi-collateral), 41 (would cause liquidation).
await client.setPnlPreference({
  symbol: 'PF_BTCUSD',
  pnlPreference: 'USDT',
});

getSelfTradeStrategy()

Returns the account-wide self-trade prevention strategy currently configured.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/self-trade-strategy
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<{ strategy: FuturesSelfTradeStrategy }>>
const response = await client.getSelfTradeStrategy();
console.log(response.strategy);
// "REJECT_TAKER" | "CANCEL_MAKER_SELF" | "CANCEL_MAKER_CHILD" | "CANCEL_MAKER_ANY"

updateSelfTradeStrategy(params)

Updates the account-wide self-trade prevention strategy.
  • HTTP method: PUT
  • Endpoint: derivatives/api/v3/self-trade-strategy
  • Auth required: Yes
strategy
string
required
One of: REJECT_TAKER, CANCEL_MAKER_SELF, CANCEL_MAKER_CHILD, CANCEL_MAKER_ANY.
Returns: Promise<DerivativesAPISuccessResponse<{ strategy: FuturesSelfTradeStrategy }>>
StrategyBehaviour
REJECT_TAKERThe incoming taker order is rejected if it would match a maker order from the same account
CANCEL_MAKER_SELFThe resting maker order from the same API key is cancelled
CANCEL_MAKER_CHILDThe resting maker from any key on the same account is cancelled
CANCEL_MAKER_ANYAny resting maker that would self-trade is cancelled
const response = await client.updateSelfTradeStrategy({
  strategy: 'CANCEL_MAKER_SELF',
});
console.log('Updated strategy:', response.strategy);

Subaccounts

getSubaccounts()

Returns information about all subaccounts under the master account, including balances and UIDs.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/subaccounts
  • Auth required: Yes
Returns: Promise<DerivativesAPISuccessResponse<FuturesSubaccountsInfo>>
const info = await client.getSubaccounts();

console.log('Master UID:', info.masterAccountUid);
for (const sub of info.subaccounts) {
  console.log(sub.accountUid, sub.email);
  console.log('  Flex margin equity:', sub.flexAccount.marginEquity);
}

getSubaccountTradingStatus(params)

Returns trading capability information for a specific subaccount.
  • HTTP method: GET
  • Endpoint: derivatives/api/v3/subaccount/{subaccountUid}/trading-enabled
  • Auth required: Yes
subaccountUid
string
required
The UID of the subaccount to query.
Returns: Promise<DerivativesAPISuccessResponse<{ tradingEnabled: boolean }>>
const status = await client.getSubaccountTradingStatus({
  subaccountUid: '6e5378ff-31ce-44e8-929f-23f822aa5673',
});
console.log('Trading enabled:', status.tradingEnabled);

updateSubaccountTradingStatus(params)

Enables or disables trading capabilities for a specific subaccount.
  • HTTP method: PUT
  • Endpoint: derivatives/api/v3/subaccount/{subaccountUid}/trading-enabled
  • Auth required: Yes
subaccountUid
string
required
The UID of the subaccount to update.
tradingEnabled
boolean
required
true to enable trading, false to disable.
Returns: Promise<DerivativesAPISuccessResponse<{ tradingEnabled: boolean }>>
// Enable trading for a subaccount
await client.updateSubaccountTradingStatus({
  subaccountUid: '6e5378ff-31ce-44e8-929f-23f822aa5673',
  tradingEnabled: true,
});

// Disable trading
await client.updateSubaccountTradingStatus({
  subaccountUid: '6e5378ff-31ce-44e8-929f-23f822aa5673',
  tradingEnabled: false,
});

Common Flows

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

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

async function accountSummary() {
  const [accounts, positions, fills] = await Promise.all([
    client.getAccounts(),
    client.getOpenPositions(),
    client.getFills(),
  ]);

  const flex = accounts.accounts.flex;
  console.log('=== Account Summary ===');
  if (flex) {
    console.log('Portfolio value:', flex.portfolioValue);
    console.log('Available margin:', flex.available);
    console.log('Unrealised PnL:', flex.pnl);
  }

  console.log('\n=== Open Positions ===');
  for (const pos of positions.openPositions) {
    console.log(`${pos.symbol} ${pos.side} ${pos.size} @ ${pos.price}`);
  }

  console.log('\n=== Recent Fills ===');
  for (const fill of fills.fills.slice(0, 5)) {
    console.log(`${fill.symbol} ${fill.side} ${fill.size} @ ${fill.price}`);
  }
}

accountSummary();

Build docs developers (and LLMs) love